Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1341531 - Measure input event dispatching latency. (*_EVENT_RECEI…
Browse files Browse the repository at this point in the history
…VED_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
  • Loading branch information
legnaleurc committed Feb 8, 2017
1 parent 8a0ceeb commit bf99127
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
23 changes: 23 additions & 0 deletions layout/base/PresShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8059,10 +8059,13 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
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;
Expand All @@ -8071,6 +8074,14 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
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) {
Expand All @@ -8083,6 +8094,18 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
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;
}
Expand Down
54 changes: 54 additions & 0 deletions toolkit/components/telemetry/Histograms.json
Original file line number Diff line number Diff line change
Expand Up @@ -11052,5 +11052,59 @@
"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."
}
}

0 comments on commit bf99127

Please sign in to comment.