Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2025)

Unified Diff: components/scheduler/renderer/renderer_task_duration.cc

Issue 2184023002: Report the duration of sampled tasks with histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/scheduler/renderer/renderer_task_duration.cc
diff --git a/components/scheduler/renderer/renderer_task_duration.cc b/components/scheduler/renderer/renderer_task_duration.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e5c9c89d8ce932f040c1b6f4a617671858fd713d
--- /dev/null
+++ b/components/scheduler/renderer/renderer_task_duration.cc
@@ -0,0 +1,24 @@
+// 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 "base/metrics/histogram_macros.h"
+#include "components/scheduler/renderer/renderer_task_duration.h"
majidvp 2016/07/27 13:50:59 The class's own header should be included first. T
sunyunjia 2016/07/27 17:28:42 Done.
+
+namespace scheduler {
+ RendererTaskDuration::RendererTaskDuration()
+ : sample_count_(0) {
majidvp 2016/07/27 13:50:59 The initializer list should be on the same line as
sunyunjia 2016/07/27 17:28:42 Done.
+ }
+
+ RendererTaskDuration::~RendererTaskDuration() {
majidvp 2016/07/27 13:50:59 Move closing brace to the same line for this empty
sunyunjia 2016/07/27 17:28:42 Done.
+ }
+
+ void RendererTaskDuration::ReportSampleDuration(base::TimeDelta duration) {
+ ++sample_count_;
+ if (sample_count_ % kSampleInterval == 0) {
majidvp 2016/07/27 13:50:59 Given that we reset the sample count to 0. Should
sunyunjia 2016/07/27 17:28:42 Done.
+ UMA_HISTOGRAM_TIMES("RendererScheduler.TaskDuration",
majidvp 2016/07/27 13:50:59 UMA_HISTGRAM_TIMES range is 1ms - 10seconds. This
+ duration);
majidvp 2016/07/27 13:50:59 The line break is not needed. Falls within the 80
sunyunjia 2016/07/27 17:28:42 Done.
+ sample_count_ = 0;
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698