Bug 1341531 - Measure input event dispatching latency. (*_EVENT_RECEIVED_MS) r=smaug
authorWei-Cheng Pan <wpan@mozilla.com>
Wed, 08 Feb 2017 15:11:53 +0800
changeset 349024 e846c455670e2ead2af27ba41983cfe3b9baf234
parent 349023 2cb65b6a5a873089b310383a9509b9b6c8221ed3
child 349025 ee19e49280f3f9ea4a0bcdb1c3480bc53f16165c
push id39385
push userwpan@mozilla.com
push dateThu, 23 Mar 2017 08:50:56 +0000
treeherderautoland@e846c455670e [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,64 @@ 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);
+        MOZ_FALLTHROUGH;
       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
@@ -11114,10 +11114,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."
   }
 }