Skip to content

Commit

Permalink
bug 1941601 - Add measure() to labeled_timing_distribution's docs, to…
Browse files Browse the repository at this point in the history
…o [doc only]
  • Loading branch information
chutten committed Jan 24, 2025
1 parent 874f577 commit 0ba78a7
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/user/reference/metrics/labeled_timing_distributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,41 @@ Glean.devtools.coldToolboxOpenDelay[toolboxId].accumulateSamples(sample);
{{#include ../../_includes/label-errors.md}}


### `measure`

For convenience one can measure the time of a function or block of code.

{{#include ../../../shared/tab_header.md}}

<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Rust" class="tab"></div>
<div data-lang="JavaScript" class="tab"></div>
<div data-lang="Firefox Desktop" class="tab">

**C++**

```c++
#include "mozilla/glean/DevtoolsClientFrameworkMetrics.h"

{ // Scope for RAII
auto timer = mozilla::glean::devtools::cold_toolbox_open_delay
.Get(toolboxId)
.Measure();
// Open the toolbox. Cold.
}
```

**JavaScript**

*Not currently implemented.*

</div>

{{#include ../../../shared/tab_footer.md}}

## Testing API

### `testGetValue`
Expand Down

0 comments on commit 0ba78a7

Please sign in to comment.