Allow AutoMetricRecording to record to both a perfstats metric and a glean metric
Categories
(Core :: mozglue, task)
Tracking
()
People
(Reporter: morgan, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
I spoke with some perf team members at the engineering summit about techniques for examining "in the wild" performance. The general advice I received was to:
- Take the perf metrics that we've already defined and mirror their values to glean metrics.
- Use the glean data to create a histogram of performance experiences
- Investigate the poor-performance experiences of those at the high end of the spectrum via perftests etc.
Mirroring the value is easy enough when using the "raw duration" versions of both glean and perfmetrics, since the time.Now() - start value can be passed directly into both calls. You can see an example of that pattern here.
This kind of mirroring is harder, though, when using the RAII auto-measuerer. You have to instantiate two different timers, one for perfstats and one for glean. This means you'll end up with two different recorded values, one which includes the time it takes to create the other. It doesn't look like the overhead here is huge, but I think it'd be a bit more intuitive to have the logged values for both be identical.
I'm opening this bug to explore modifying the AutoMetricRecording class to record to both glean and perfstats, identically.
| Reporter | ||
Comment 1•25 days ago
•
|
||
One way to do this is to add a new template argument like this:
template <Metric N, auto GleanMirror = nullptr>
class AutoMetricRecording {
and call the glean recording method in the deconstructor like this:
~AutoMetricRecording() {
...
GleanMirror->AccumulateRawDuration(duration);
...}
Metrics would then be recorded/constructed like this:
PerfStats::AutoMetricRecording<PerfStats::Metric::A11Y_SendCache,
&glean::a11y::send_cache_time>
autoRecording;
We could also just pass the glean metric into the constructor, but then we'd have to import the glean headers here, and I'm not sure if that's a dependency we want in mozglue. I'll post a patch for the template version, in case that's an acceptable direction.
| Reporter | ||
Comment 2•25 days ago
•
|
||
This patch allows an optional Glean metric to be passed as the second template
arg to AutoMetricRecording. On destruction, the duration measured
is recorded in the Glean metric. It is also recorded in the PerfStats metric if
collection is enabled.
Existing callers that don't supply this arg are unchanged.
Updated•25 days ago
|
Updated•25 days ago
|
Updated•11 days ago
|
Description
•