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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 17757002: Add UMA/Telemetry stats for touch event latency (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add LatencyInfo::FindLatency() && Only use one metric for touch ack latency Created 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 if (!should_auto_resize_) 2558 if (!should_auto_resize_)
2559 return; 2559 return;
2560 2560
2561 OnRenderAutoResized(new_size); 2561 OnRenderAutoResized(new_size);
2562 } 2562 }
2563 2563
2564 void RenderWidgetHostImpl::DetachDelegate() { 2564 void RenderWidgetHostImpl::DetachDelegate() {
2565 delegate_ = NULL; 2565 delegate_ = NULL;
2566 } 2566 }
2567 2567
2568 void RenderWidgetHostImpl::ComputeTouchLatency(
2569 const ui::LatencyInfo& latency_info) {
2570 ui::LatencyInfo::LatencyComponent ui_component;
2571 ui::LatencyInfo::LatencyComponent rwh_component;
2572 ui::LatencyInfo::LatencyComponent acked_component;
2573
2574 if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
2575 0,
2576 &ui_component) ||
2577 !latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT,
2578 GetLatencyComponentId(),
2579 &rwh_component))
2580 return;
2581
2582 DCHECK(ui_component.event_count == 1);
2583 DCHECK(rwh_component.event_count == 1);
2584
2585 base::TimeDelta ui_delta =
2586 rwh_component.event_time - ui_component.event_time;
2587 rendering_stats_.touch_ui_count++;
2588 rendering_stats_.total_touch_ui_latency += ui_delta;
2589 UMA_HISTOGRAM_CUSTOM_COUNTS(
2590 "Event.Latency.Browser.TouchUI",
2591 ui_delta.InMicroseconds(),
2592 0,
2593 20000,
2594 100);
2595
2596 latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT,
sadrul 2013/06/27 17:44:01 Check return value of FindLatency
Yufeng Shen (Slow to review) 2013/06/27 19:01:03 Done.
2597 0,
2598 &acked_component);
2599 base::TimeDelta acked_delta =
2600 acked_component.event_time - rwh_component.event_time;
2601 rendering_stats_.touch_acked_count++;
2602 rendering_stats_.total_touch_acked_latency += acked_delta;
2603 UMA_HISTOGRAM_CUSTOM_COUNTS(
2604 "Event.Latency.Browser.TouchAcked",
2605 acked_delta.InMicroseconds(),
2606 0,
2607 1000000,
2608 100);
2609
2610 if (CommandLine::ForCurrentProcess()->HasSwitch(
2611 switches::kEnableGpuBenchmarking))
2612 Send(new ViewMsg_SetBrowserRenderingStats(routing_id_, rendering_stats_));
2613 }
2614
2568 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { 2615 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) {
2569 ui::LatencyInfo::LatencyMap::const_iterator l = 2616 ui::LatencyInfo::LatencyMap::const_iterator l =
2570 latency_info.latency_components.find(std::make_pair( 2617 latency_info.latency_components.find(std::make_pair(
2571 ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, GetLatencyComponentId())); 2618 ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, GetLatencyComponentId()));
2572 if (l == latency_info.latency_components.end()) 2619 if (l == latency_info.latency_components.end())
2573 return; 2620 return;
2574 2621
2575 rendering_stats_.input_event_count += l->second.event_count; 2622 rendering_stats_.input_event_count += l->second.event_count;
2576 rendering_stats_.total_input_latency += 2623 rendering_stats_.total_input_latency +=
2577 l->second.event_count * 2624 l->second.event_count *
(...skipping 18 matching lines...) Expand all
2596 int process_id = (b->first.second >> 32) & 0xffffffff; 2643 int process_id = (b->first.second >> 32) & 0xffffffff;
2597 RenderWidgetHost* rwh = 2644 RenderWidgetHost* rwh =
2598 RenderWidgetHost::FromID(process_id, routing_id); 2645 RenderWidgetHost::FromID(process_id, routing_id);
2599 if (!rwh) 2646 if (!rwh)
2600 continue; 2647 continue;
2601 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); 2648 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info);
2602 } 2649 }
2603 } 2650 }
2604 2651
2605 } // namespace content 2652 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698