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

Unified Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker.cc

Issue 2596473002: Add more input metrics to Rappor (Closed)
Patch Set: Move the assertion line out of the test function Created 4 years 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 | « no previous file | content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
index a4ef557261591bf2ba8a70a0f4f2c8fd74979491..5494a0c1762b3c85c22727c95aa073fa69fcdd7e 100644
--- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
+++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
@@ -101,6 +101,22 @@ void UpdateLatencyCoordinates(const WebInputEvent& event,
DCHECK(!end.last_event_time.is_null()); \
DCHECK_GE(end.last_event_time, start.first_event_time);
+// Touch/wheel to scroll latency using Rappor.
+#define RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(delegate, name, start, end) \
+ CONFIRM_VALID_TIMING(start, end) \
+ rappor::RapporService* rappor_service = \
+ GetContentClient()->browser()->GetRapporService(); \
+ if (rappor_service && delegate) { \
+ std::unique_ptr<rappor::Sample> sample = \
+ rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); \
+ delegate->AddDomainInfoToRapporSample(sample.get()); \
+ sample->SetUInt64Field( \
+ "Latency", \
+ (end.last_event_time - start.first_event_time).InMicroseconds(), \
+ rappor::NO_NOISE); \
+ rappor_service->RecordSample(name, std::move(sample)); \
+ }
+
// Touch/wheel to scroll latency that is mostly under 1 second.
#define UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(name, start, end) \
CONFIRM_VALID_TIMING(start, end) \
@@ -248,6 +264,7 @@ void ComputeTouchAndWheelScrollLatencyHistograms(
const ui::LatencyInfo& latency,
const std::string event_type_name) {
DCHECK(!latency.coalesced());
+ DCHECK(event_type_name == "Touch" || event_type_name == "Wheel");
if (latency.coalesced())
return;
@@ -266,6 +283,12 @@ void ComputeTouchAndWheelScrollLatencyHistograms(
".TimeToScrollUpdateSwapBegin2",
original_component, gpu_swap_begin_component);
+ RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(
+ render_widget_host_delegate,
+ "Event.Latency.ScrollBegin." + event_type_name +
+ ".TimeToScrollUpdateSwapBegin2",
+ original_component, gpu_swap_begin_component);
+
// TODO(lanwei): Will remove them when M56 is stable, see
// https://crbug.com/669618.
UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(
@@ -284,21 +307,10 @@ void ComputeTouchAndWheelScrollLatencyHistograms(
".TimeToScrollUpdateSwapBegin2",
original_component, gpu_swap_begin_component);
- rappor::RapporService* rappor_service =
- GetContentClient()->browser()->GetRapporService();
- if (rappor_service && render_widget_host_delegate) {
- std::unique_ptr<rappor::Sample> sample =
- rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE);
- render_widget_host_delegate->AddDomainInfoToRapporSample(sample.get());
- sample->SetUInt64Field("Latency",
- (gpu_swap_begin_component.last_event_time -
- original_component.first_event_time)
- .InMicroseconds(),
- rappor::NO_NOISE);
- rappor_service->RecordSample(
- "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2",
- std::move(sample));
- }
+ RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(
+ render_widget_host_delegate,
+ "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2",
+ original_component, gpu_swap_begin_component);
}
} else {
// No original component found.
« no previous file with comments | « no previous file | content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698