Commit 8bad78f6 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Histograms] Only add AggregatableHistogram samples if non-zero.

AggregatableHistogramTimer will always add a sample when it is destroyed,
even if there were no AggregatedHistogramTimerScope called within it. This
makes the V8.CompileLazyMicroSeconds histogram not particularly useful since
it is 90% filled with zero entries where v8 execute didn't require any
lazy function compilation

Change-Id: Ia75c8596237b22528cbba3e8ae2b67e28ea54097
Reviewed-on: https://chromium-review.googlesource.com/793452Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49674}
parent 5d3824e2
......@@ -404,7 +404,13 @@ class AggregatableHistogramTimer : public Histogram {
public:
// Start/stop the "outer" scope.
void Start() { time_ = base::TimeDelta(); }
void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); }
void Stop() {
if (time_ != base::TimeDelta()) {
// Only add non-zero samples, since zero samples represent situations
// where there were no aggregated samples added.
AddSample(static_cast<int>(time_.InMicroseconds()));
}
}
// Add a time value ("inner" scope).
void Add(base::TimeDelta other) { time_ += other; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment