pub fn monitored_scope(name: &'static str) -> Option<MonitoredScopeGuard>
Expand description
This function creates a named scoped object, that keeps track of
- the total iterations where the scope is called in the
monitored_scope_iterations
metric. - and the total duration of the scope in the
monitored_scope_duration_ns
metric.
The monitored scope should be single threaded, e.g. the scoped object encompass the lifetime of
a select loop or guarded by mutex.
Then the rate of monitored_scope_duration_ns
, converted to the unit of sec / sec, would be
how full the single threaded scope is running.