Add support for single sample histograms which report upon process destruction or explicit signal. |
||||
Issue descriptionDue to the fast shutdown process which kills renderer processes without any chance for recording final metrics, we need a mechanism for histograms which want to report a single sample that may vary over the lifetime of an object. E.g., we want to report a single sample indicating the amount of time watched by a user. Today this is done by a custom proxy in the media code base that IPCs a value over to the browser process where a render process watcher records the final value in the event of process termination (see WatchTimeReporter and MediaInternals). We have many more of these examples and seem to be running into a new use case every couple months, so it'd be nice to codify this into a formal UMA mechanism.
,
Apr 28 2017
+ Max and I, to follow along, as we'll need this for our work on the new Expected task Queueing Time metric.
,
Apr 28 2017
,
May 4 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4a9839a21d7fd95641ba584396bf328fbc1a96b0 commit 4a9839a21d7fd95641ba584396bf328fbc1a96b0 Author: dalecurtis <dalecurtis@chromium.org> Date: Thu May 04 23:40:47 2017 Add support for single sample metrics. Single sample metrics offer a mechanism for clients to modify a histogram sample repeatedly while having it only reported once; either upon destruction of a helper class or at process termination. This is helpful since the fast shutdown path simply kills renderer processes without going through any destructors. In this case we lose histogram values that might otherwise be reported at that time. In media/ code we've created a cumbersome proxy mechanism which sends histogram values like this to the browser process and records them there (see WatchTimeReporter and MediaInternals interactions). Single sample histograms are implemented through a new mojo service hosted by the browser process that receives samples and logs the last received sample upon mojo channel closure. base:: shims are provided so that these metrics can be created by anyone in the renderer process. For non-renderer processes a default implementation is provided without the mojo channel behavior. Usage looks like the following: std::unique_ptr<base::SingleSampleMetric> metric( base::SingleSampleMetricsFactory::Get()->CreateCustomCountsMetric( "Media.VideoRenderer.CadenceChanges", 1, 10, 10)); metric->SetSample(1); metric->SetSample(2); metric->SetSample(3); metric.reset(); Only the last sample (3) would end up being reported to the histogram. BUG= 689751 TEST=new tests Review-Url: https://codereview.chromium.org/2687583002 Cr-Commit-Position: refs/heads/master@{#469524} [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/base/BUILD.gn [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/base/metrics/single_sample_metrics.cc [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/base/metrics/single_sample_metrics.h [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/base/metrics/single_sample_metrics_unittest.cc [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/BUILD.gn [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/public/interfaces/BUILD.gn [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/public/interfaces/single_sample_metrics.mojom [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/single_sample_metrics.cc [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/single_sample_metrics.h [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/single_sample_metrics_factory_impl.cc [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/single_sample_metrics_factory_impl.h [add] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/metrics/single_sample_metrics_factory_impl_unittest.cc [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/test/BUILD.gn [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/test/DEPS [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/components/test/components_test_suite.cc [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/browser/BUILD.gn [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/browser/DEPS [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/browser/renderer_host/render_process_host_impl.cc [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/public/app/mojo/content_browser_manifest.json [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/renderer/BUILD.gn [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/renderer/DEPS [modify] https://crrev.com/4a9839a21d7fd95641ba584396bf328fbc1a96b0/content/renderer/render_thread_impl.cc
,
May 24 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by dalecur...@chromium.org
, Feb 8 2017