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

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;

== Synopsis

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

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


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