Bug 1341531 - Measure input event dispatching latency. (*_EVENT_RECEIVED_MS) r=smaug
☠☠ backed out by 6d2496495c2e ☠ ☠
authorWei-Cheng Pan <wpan@mozilla.com>
Wed, 08 Feb 2017 15:11:53 +0800
changeset 348761 140374af2570a1dfb4180d7f5df44bcc68c8a6c0
parent 348760 ca09d56a65e4a107609dad8ab92a78a20d0be8ed
child 348762 6d2496495c2e149d6ef9f551e5210c042c627aa9
push id31535
push usercbook@mozilla.com
push dateWed, 22 Mar 2017 13:25:07 +0000
treeherdermozilla-central@ee30286771eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1341531
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1341531 - Measure input event dispatching latency. (*_EVENT_RECEIVED_MS) r=smaug This patch measures the time from an input event creation, to it been dispatched to PresShell, but just before any handler been executed. MozReview-Commit-ID: 6ZYra7YYICY
layout/base/PresShell.cpp
toolkit/components/telemetry/Histograms.json
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -8054,40 +8054,63 @@ PresShell::HandleEventInternal(WidgetEve
           // Allow keys other than ESC and modifiers be marked as a
           // valid user input for triggering popup, fullscreen, and
           // pointer lock.
           isHandlingUserInput = true;
           mPresContext->RecordInteractionTime(
             nsPresContext::InteractionType::eKeyInteraction,
             aEvent->mTimeStamp);
         }
+
+        Telemetry::AccumulateTimeDelta(Telemetry::KEYBOARD_EVENT_RECEIVED_MS, aEvent->mTimeStamp);
         break;
       }
       case eMouseDown:
       case eMouseUp:
+        Telemetry::AccumulateTimeDelta(Telemetry::MOUSE_CLICK_EVENT_RECEIVED_MS, aEvent->mTimeStamp);
       case ePointerDown:
       case ePointerUp:
         isHandlingUserInput = true;
         mPresContext->RecordInteractionTime(
           nsPresContext::InteractionType::eClickInteraction,
           aEvent->mTimeStamp);
         break;
 
+      case eMouseMove:
+        if (aEvent->mFlags.mHandledByAPZ) {
+          Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_MOUSE_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp);
+        } else {
+          Telemetry::AccumulateTimeDelta(Telemetry::MOUSE_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp);
+        }
+        break;
+
       case eDrop: {
         nsCOMPtr<nsIDragSession> session = nsContentUtils::GetDragSession();
         if (session) {
           bool onlyChromeDrop = false;
           session->GetOnlyChromeDrop(&onlyChromeDrop);
           if (onlyChromeDrop) {
             aEvent->mFlags.mOnlyChromeDispatch = true;
           }
         }
         break;
       }
 
+      case eWheel:
+        if (aEvent->mFlags.mHandledByAPZ) {
+          Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_WHEEL_EVENT_RECEIVED_MS, aEvent->mTimeStamp);
+        }
+        break;
+
+      case eTouchMove:
+        if (aEvent->mFlags.mHandledByAPZ) {
+          Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_TOUCH_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp);
+        }
+        break;
+
       default:
         break;
       }
 
       if (!mTouchManager.PreHandleEvent(aEvent, aStatus,
                                         touchIsNew, isHandlingUserInput,
                                         mCurrentEventContent)) {
         return NS_OK;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -11047,10 +11047,64 @@
     "alert_emails": ["mlayzell@mozilla.com"],
     "bug_numbers": [1342635],
     "expires_in_version": "60",
     "kind": "exponential",
     "high": 500,
     "n_buckets": 20,
     "keyed": true,
     "description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to serialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
+  },
+  "MOUSE_MOVE_EVENT_RECEIVED_MS": {
+    "alert_emails": ["wpan@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 50000,
+    "n_buckets": 100,
+    "bug_numbers": [1341531],
+    "description": "Time (ms) for the mouse move event to dispatch, but before handlers executing."
+  },
+  "MOUSE_CLICK_EVENT_RECEIVED_MS": {
+    "alert_emails": ["wpan@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 50000,
+    "n_buckets": 100,
+    "bug_numbers": [1341531],
+    "description": "Time (ms) for the mouse click event to dispatch, but before handlers executing."
+  },
+  "KEYBOARD_EVENT_RECEIVED_MS": {
+    "alert_emails": ["wpan@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 50000,
+    "n_buckets": 100,
+    "bug_numbers": [1341531],
+    "description": "Time (ms) for the keyboard event to dispatch, but before handlers executing."
+  },
+  "APZ_HANDLED_TOUCH_MOVE_EVENT_RECEIVED_MS": {
+    "alert_emails": ["wpan@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 50000,
+    "n_buckets": 100,
+    "bug_numbers": [1341531],
+    "description": "Time (ms) for the APZ handled touch move event to dispatch, but before handlers executing."
+  },
+  "APZ_HANDLED_MOUSE_MOVE_EVENT_RECEIVED_MS": {
+    "alert_emails": ["wpan@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 50000,
+    "n_buckets": 100,
+    "bug_numbers": [1341531],
+    "description": "Time (ms) for the APZ handled mouse move event to dispatch, but before handlers executing."
+  },
+  "APZ_HANDLED_WHEEL_EVENT_RECEIVED_MS": {
+    "alert_emails": ["wpan@mozilla.com"],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 50000,
+    "n_buckets": 100,
+    "bug_numbers": [1341531],
+    "description": "Time (ms) for the APZ handled wheel event to dispatch, but before handlers executing."
   }
 }