Chromium Code Reviews| Index: components/scheduler/renderer/task_duration_reporter.cc |
| diff --git a/components/scheduler/renderer/task_duration_reporter.cc b/components/scheduler/renderer/task_duration_reporter.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bdd44b38a2f203fbb5c96c1d530a9d4184ceb3c2 |
| --- /dev/null |
| +++ b/components/scheduler/renderer/task_duration_reporter.cc |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/scheduler/renderer/task_duration_reporter.h" |
| + |
| +#include "base/metrics/histogram_macros.h" |
| + |
| +namespace scheduler { |
| +namespace { |
| + const int kSampleInterval = 100; |
|
tdresser
2016/07/27 18:04:25
This shouldn't be indented, should it? Play around
sunyunjia
2016/07/27 19:51:04
Done.
|
| +} |
| + |
| + TaskDurationReporter::TaskDurationReporter() : sample_count_(0) {} |
|
majidvp
2016/07/27 18:34:02
nit: same as above. Should not be indented.
sunyunjia
2016/07/27 19:51:04
Done.
|
| + |
| + TaskDurationReporter::~TaskDurationReporter() {} |
| + |
| + void TaskDurationReporter::ReportSampleDuration(base::TimeDelta duration) { |
| + ++sample_count_; |
| + if (sample_count_ == kSampleInterval) { |
| + // [1msec ~ 10sec], 50 bins. All tasks longer than 10sec will be put into |
| + // the same bin. |
| + UMA_HISTOGRAM_TIMES("RendererScheduler.TaskDuration", duration); |
|
tdresser
2016/07/27 18:04:25
For input latency, we use
UMA_HISTOGRAM_CUSTOM_C
sunyunjia
2016/07/27 19:51:04
Done.
|
| + sample_count_ = 0; |
| + } |
| + } |
| +} |