BloombergLP::balm::StopwatchScopedGuard::StopwatchScopedGuard

Initialize this scoped guard to record an elapsed time to the specified metricId using the specified timeUnits.

Synopsis

Declared in <balm_stopwatchscopedguard.h>

StopwatchScopedGuard(
    MetricId const& metricId,
    Units timeUnits,
    MetricsManager* manager = 0);

Description

Optionally specify a metrics manager. If manager is 0, the DefaultMetricsManager singleton instance is used. If no manager is supplied and the default instance has not been created, this object will be inactive (i.e., it will not record any values); similarly, if the metric's associated category is disabled (i.e., metricId.category()->enabled() is false), then this object will be inactive. The behavior is undefined unless metricId is a valid id returned by the MetricRepository object owned by the indicated metrics manager. Note that timeUnits indicates the scale of the double value reported by this guard, but does not affect the precision of the elapsed time measurement.

Parameters

NameDescription
metricIdidentity of the metric to record
timeUnitsunits in which to report elapsed time
managermetrics manager used to provide the collector (optional)