[#BloombergLP-balm-StopwatchScopedGuard-2constructor-022]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::xref:BloombergLP/balm/StopwatchScopedGuard.adoc[StopwatchScopedGuard]::StopwatchScopedGuard
:relfileprefix: ../../../
:mrdocs:

Constructors

== Synopses

Declared in `&lt;balm&lowbar;stopwatchscopedguard&period;h&gt;`

Initialize this scoped guard to record an elapsed time to the specified `metricId` from the optionally specified `manager`&period; Optionally specify the `timeUnits` in which to report elapsed time&period; If `timeUnits` is not provided, the elapsed time will be reported in seconds&period; If `manager` is 0, the `DefaultMetricsManager` singleton instance is used&period; If no `manager` is supplied and the default instance has not been created, this object will be inactive (i&period;e&period;, it will not record any values)&semi; similarly, if the metric&apos;s associated category is disabled (i&period;e&period;, `metricId&period;category()&hyphen;&gt;enabled()` is `false`), then this object will be inactive&period; The behavior is undefined unless unless `metricId` is a valid id returned by the `MetricRepository` object owned by the indicated metrics manager&period; 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&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-05.adoc[StopwatchScopedGuard](
    xref:BloombergLP/balm/MetricId.adoc[MetricId] const& metricId,
    xref:BloombergLP/balm/MetricsManager.adoc[MetricsManager]* manager = 0);
----

[.small]#xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-05.adoc[_» more&period;&period;&period;_]#

Initialize this scoped guard to record elapsed time using the specified `collector`&period; Optionally specify the `timeUnits` in which to report elapsed time&period; If `collector` is 0 or`collector&hyphen;&gt;category()&period;enabled() &equals;&equals; false`, this object will be inactive (i&period;e&period;, will not record any values)&period; The behavior is undefined unless `collector &equals;&equals; 0 &verbar;&verbar; collector&hyphen;&gt;metricId()&period;isValid()`&period; 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&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-01.adoc[StopwatchScopedGuard](
    xref:BloombergLP/balm/Collector.adoc[Collector]* collector,
    xref:BloombergLP/balm/StopwatchScopedGuard/Units.adoc[Units] timeUnits = k&lowbar;SECONDS);
----

[.small]#xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-01.adoc[_» more&period;&period;&period;_]#

Initialize this scoped guard to record elapsed time using the specified `metric`&period; Optionally specify the `timeUnits` in which to report elapsed time&period; If `metric&hyphen;&gt;isActive()` is `false`, this object will also be inactive (i&period;e&period;, will not record any values)&period; The behavior is undefined unless `metric` is a valid address of a `Metric` object&period; 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&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-020.adoc[StopwatchScopedGuard](
    xref:BloombergLP/balm/Metric.adoc[Metric]* metric,
    xref:BloombergLP/balm/StopwatchScopedGuard/Units.adoc[Units] timeUnits = k&lowbar;SECONDS);
----

[.small]#xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-020.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified `timeUnits`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-0e.adoc[StopwatchScopedGuard](
    xref:BloombergLP/balm/MetricId.adoc[MetricId] const& metricId,
    xref:BloombergLP/balm/StopwatchScopedGuard/Units.adoc[Units] timeUnits,
    xref:BloombergLP/balm/MetricsManager.adoc[MetricsManager]* manager = 0);
----

[.small]#xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-0e.adoc[_» more&period;&period;&period;_]#

Initialize this scoped guard to record an elapsed time to the metric, identified by the specified `category` and `name`, from the optionally specified `manager`&period; Optionally specify the `timeUnits` in which to report elapsed time&period; If `timeUnits` is not provided, the elapsed time will be reported in seconds&period; If `manager` is 0, use the `DefaultMetricsManager` instance&period; If no `manager` is supplied, and the default instance has not been created, this object will be inactive (i&period;e&period;, it will not record any values)&semi; similarly, if the identified `category` is disabled, then this object will be inactive&period; The behavior is undefined unless `category` and `name` are null&hyphen;terminated&period; 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&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-0f.adoc[StopwatchScopedGuard](
    char const* category,
    char const* name,
    xref:BloombergLP/balm/MetricsManager.adoc[MetricsManager]* manager = 0);
----

[.small]#xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-0f.adoc[_» more&period;&period;&period;_]#

Create a scoped guard for the specified `category`, `name`, and `timeUnits`, optionally using the specified `manager`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-09.adoc[StopwatchScopedGuard](
    char const* category,
    char const* name,
    xref:BloombergLP/balm/StopwatchScopedGuard/Units.adoc[Units] timeUnits,
    xref:BloombergLP/balm/MetricsManager.adoc[MetricsManager]* manager = 0);
----

[.small]#xref:BloombergLP/balm/StopwatchScopedGuard/2constructor-09.adoc[_» more&period;&period;&period;_]#


[.small]#Created with https://www.mrdocs.com[MrDocs]#
