Chromium Code Reviews| Index: ui/base/x/x11_util.cc |
| diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc |
| index 35e27636d94ecc64277e39bb17b6605d9166882c..844be0a80358aa63467493da1f476a127a9d0e80 100644 |
| --- a/ui/base/x/x11_util.cc |
| +++ b/ui/base/x/x11_util.cc |
| @@ -28,6 +28,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/singleton.h" |
| #include "base/message_loop.h" |
| +#include "base/metrics/histogram.h" |
| #include "base/string_number_conversions.h" |
| #include "base/string_util.h" |
| #include "base/stringprintf.h" |
| @@ -564,6 +565,7 @@ int CoalescePendingMotionEvents(const XEvent* xev, |
| } |
| #endif |
| + base::TimeDelta first_coalesed_time; |
| while (XPending(display)) { |
| XEvent next_event; |
| XPeekEvent(display, &next_event); |
| @@ -620,6 +622,9 @@ int CoalescePendingMotionEvents(const XEvent* xev, |
| // Get the event and its cookie data. |
| XNextEvent(display, last_event); |
| XGetEventData(display, &last_event->xcookie); |
| + |
| + if (num_coalesed == 0) |
| + first_coalesed_time = ui::EventTimeFromNative(last_event); |
|
Rick Byers
2013/04/05 15:30:35
I think the first coalesced event is really xev, w
varunjain
2013/04/05 19:22:58
Done.
|
| ++num_coalesed; |
| continue; |
| } else { |
| @@ -629,6 +634,20 @@ int CoalescePendingMotionEvents(const XEvent* xev, |
| } |
| break; |
| } |
| + UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.CoalesedCount", |
|
Rick Byers
2013/04/05 15:30:35
UMA_HISTOGRAM_COUNTS_10000 should be sufficient (5
Rick Byers
2013/04/05 15:30:35
Event.Latency.Browser has an existing common meani
varunjain
2013/04/05 19:22:58
Done.
varunjain
2013/04/05 19:22:58
Done.
|
| + num_coalesed, 0, 10000, 100); |
| + std::string name_for_event = base::StringPrintf( |
| + "Event.Latency.Browser.Coalesed.%s", |
| + (ui::IsMouseEvent(const_cast<XEvent*>(xev)) ? "Mouse" : "Touch")); |
|
Rick Byers
2013/04/05 15:30:35
Please add a CHECK that verifies all events here a
Rick Byers
2013/04/05 15:30:35
If we're going to separate Mouse and Touch here, t
flackr
2013/04/05 16:10:56
Drive-by, wouldn't it be better / more efficient t
varunjain
2013/04/05 19:22:58
Done.
varunjain
2013/04/05 19:22:58
Done.
varunjain
2013/04/05 19:22:58
Done.
|
| + base::TimeDelta delta = EventTimeForNow() - first_coalesed_time; |
|
Rick Byers
2013/04/05 15:30:35
The Event.Latency.Browser metrics already track th
varunjain
2013/04/05 19:22:58
Done.
|
| + base::HistogramBase* counter_for_type = |
| + base::Histogram::FactoryGet( |
|
Rick Byers
2013/04/05 15:30:35
Isn't this fully dynamic histogram generation over
DaveMoore
2013/04/05 16:46:15
The macros don't support this...they get confused
varunjain
2013/04/05 19:22:58
Done.
varunjain
2013/04/05 19:22:58
Done.
|
| + name_for_event, |
| + 0, |
| + 1000000, |
| + 100, |
| + base::HistogramBase::kUmaTargetedHistogramFlag); |
| + counter_for_type->Add(delta.InMicroseconds()); |
| return num_coalesed; |
| } |
| #endif |