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

Side by Side Diff: ui/base/x/x11_util.cc

Issue 13529009: Add UMA metrics for measuring number of coalesed events and their latency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/events/event_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file defines utility functions for X11 (Linux only). This code has been 5 // This file defines utility functions for X11 (Linux only). This code has been
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support
7 // remains woefully incomplete. 7 // remains woefully incomplete.
8 8
9 #include "ui/base/x/x11_util.h" 9 #include "ui/base/x/x11_util.h"
10 10
(...skipping 10 matching lines...) Expand all
21 #include <X11/extensions/shape.h> 21 #include <X11/extensions/shape.h>
22 #include <X11/extensions/XInput2.h> 22 #include <X11/extensions/XInput2.h>
23 #include <X11/extensions/Xrandr.h> 23 #include <X11/extensions/Xrandr.h>
24 24
25 #include "base/bind.h" 25 #include "base/bind.h"
26 #include "base/command_line.h" 26 #include "base/command_line.h"
27 #include "base/logging.h" 27 #include "base/logging.h"
28 #include "base/memory/scoped_ptr.h" 28 #include "base/memory/scoped_ptr.h"
29 #include "base/memory/singleton.h" 29 #include "base/memory/singleton.h"
30 #include "base/message_loop.h" 30 #include "base/message_loop.h"
31 #include "base/metrics/histogram.h"
31 #include "base/string_number_conversions.h" 32 #include "base/string_number_conversions.h"
32 #include "base/string_util.h" 33 #include "base/string_util.h"
33 #include "base/stringprintf.h" 34 #include "base/stringprintf.h"
34 #include "base/sys_byteorder.h" 35 #include "base/sys_byteorder.h"
35 #include "base/threading/thread.h" 36 #include "base/threading/thread.h"
36 #include "ui/base/events/event_utils.h" 37 #include "ui/base/events/event_utils.h"
37 #include "ui/base/keycodes/keyboard_code_conversion_x.h" 38 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
38 #include "ui/base/touch/touch_factory_x11.h" 39 #include "ui/base/touch/touch_factory_x11.h"
39 #include "ui/base/x/valuators.h" 40 #include "ui/base/x/valuators.h"
40 #include "ui/base/x/x11_util_internal.h" 41 #include "ui/base/x/x11_util_internal.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 XGetEventData(display, &last_event->xcookie); 623 XGetEventData(display, &last_event->xcookie);
623 ++num_coalesed; 624 ++num_coalesed;
624 continue; 625 continue;
625 } else { 626 } else {
626 // This isn't an event we want so free its cookie data. 627 // This isn't an event we want so free its cookie data.
627 XFreeEventData(display, &next_event.xcookie); 628 XFreeEventData(display, &next_event.xcookie);
628 } 629 }
629 } 630 }
630 break; 631 break;
631 } 632 }
633 if (num_coalesed > 0) {
634 base::TimeDelta delta = ui::EventTimeFromNative(last_event) -
635 ui::EventTimeFromNative(const_cast<XEvent*>(xev));
636 ui::EventType ui_type = ui::EventTypeFromNative(const_cast<XEvent*>(xev));
637 if (ui::IsMouseEventType(ui_type)) {
638 UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Mouse", num_coalesed);
639 UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Mouse", delta);
640 } else if (ui::IsTouchEventType(ui_type)) {
641 UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Touch", num_coalesed);
642 UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Touch", delta);
643 } else {
644 UMA_HISTOGRAM_COUNTS_10000("Event.CoalescedCount.Other", num_coalesed);
645 UMA_HISTOGRAM_TIMES("Event.CoalescedLatency.Other", delta);
646 }
647 }
sadrul 2013/04/05 22:14:10 This function is called only for XI_Motion or XI_T
varunjain 2013/04/05 23:22:13 Done.
632 return num_coalesed; 648 return num_coalesed;
633 } 649 }
634 #endif 650 #endif
635 651
636 void HideHostCursor() { 652 void HideHostCursor() {
637 CR_DEFINE_STATIC_LOCAL(XScopedCursor, invisible_cursor, 653 CR_DEFINE_STATIC_LOCAL(XScopedCursor, invisible_cursor,
638 (CreateInvisibleCursor(), ui::GetXDisplay())); 654 (CreateInvisibleCursor(), ui::GetXDisplay()));
639 XDefineCursor(ui::GetXDisplay(), DefaultRootWindow(ui::GetXDisplay()), 655 XDefineCursor(ui::GetXDisplay(), DefaultRootWindow(ui::GetXDisplay()),
640 invisible_cursor.get()); 656 invisible_cursor.get());
641 } 657 }
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 << "request_code " << static_cast<int>(error_event.request_code) << ", " 1810 << "request_code " << static_cast<int>(error_event.request_code) << ", "
1795 << "minor_code " << static_cast<int>(error_event.minor_code) 1811 << "minor_code " << static_cast<int>(error_event.minor_code)
1796 << " (" << request_str << ")"; 1812 << " (" << request_str << ")";
1797 } 1813 }
1798 1814
1799 // ---------------------------------------------------------------------------- 1815 // ----------------------------------------------------------------------------
1800 // End of x11_util_internal.h 1816 // End of x11_util_internal.h
1801 1817
1802 1818
1803 } // namespace ui 1819 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698