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

Unified Diff: ui/latency/latency_histogram_macros.h

Issue 2814483002: Splitting up RenderWidgetHostLatencyTracker and some renames. (Closed)
Patch Set: [Moving OnGpuSwapBuffersCompleted() back up. Created 3 years, 8 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
« no previous file with comments | « ui/latency/DEPS ('k') | ui/latency/latency_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/latency/latency_histogram_macros.h
diff --git a/ui/latency/latency_histogram_macros.h b/ui/latency/latency_histogram_macros.h
new file mode 100644
index 0000000000000000000000000000000000000000..77e3eeef70ba14e1790d33ee354294d74022430b
--- /dev/null
+++ b/ui/latency/latency_histogram_macros.h
@@ -0,0 +1,45 @@
+// Copyright 2017 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.
+
+#ifndef UI_LATENCY_LATENCY_HISTOGRAM_MACROS_H_
+#define UI_LATENCY_LATENCY_HISTOGRAM_MACROS_H_
+
+#include "base/metrics/histogram_functions.h"
+
+// Check valid timing for start and end latency components.
+#define CONFIRM_VALID_TIMING(start, end) \
+ DCHECK(!start.first_event_time.is_null()); \
+ DCHECK(!end.last_event_time.is_null()); \
+ DCHECK_GE(end.last_event_time, start.first_event_time);
+
+// Event latency that is mostly under 1 second. We should only use 100 buckets
+// when needed.
+#define UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(name, start, \
+ end) \
+ CONFIRM_VALID_TIMING(start, end) \
+ base::UmaHistogramCustomCounts( \
+ name, (end.last_event_time - start.first_event_time).InMicroseconds(), \
+ 1, 1000000, 100);
+
+#define UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(name, start, end) \
+ CONFIRM_VALID_TIMING(start, end) \
+ base::UmaHistogramCustomCounts( \
+ name, (end.last_event_time - start.first_event_time).InMilliseconds(), \
+ 1, 1000, 50);
+
+// Long touch/wheel scroll latency component that is mostly under 200ms.
+#define UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(name, start, end) \
+ CONFIRM_VALID_TIMING(start, end) \
+ base::Histogram::FactoryGet(name, 1000, 200000, 50, \
+ base::HistogramBase::kUmaTargetedHistogramFlag) \
+ ->Add((end.last_event_time - start.first_event_time).InMicroseconds());
+
+// Short touch/wheel scroll latency component that is mostly under 50ms.
+#define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(name, start, end) \
+ CONFIRM_VALID_TIMING(start, end) \
+ base::Histogram::FactoryGet(name, 1, 50000, 50, \
+ base::HistogramBase::kUmaTargetedHistogramFlag) \
+ ->Add((end.last_event_time - start.first_event_time).InMicroseconds());
+
+#endif // UI_LATENCY_LATENCY_HISTOGRAM_MACROS_H_
« no previous file with comments | « ui/latency/DEPS ('k') | ui/latency/latency_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698