Bug 1698643 - Implement a telemetry probe to collect the input latency from mouseup(followed by a click) to the next composition r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D108647
This commit is contained in:
Sean Feng 2021-03-18 14:20:20 +00:00
Родитель e4f5229edb
Коммит 395458ba54
5 изменённых файлов: 67 добавлений и 9 удалений

Просмотреть файл

@ -1101,14 +1101,30 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,
}
aEvent->mPath = nullptr;
if (aEvent->mMessage == eKeyPress && aEvent->IsTrusted()) {
if (aPresContext && aPresContext->GetRootPresContext()) {
nsRefreshDriver* driver =
aPresContext->GetRootPresContext()->RefreshDriver();
if (driver && driver->HasPendingTick()) {
driver->RegisterCompositionPayload(
{layers::CompositionPayloadType::eKeyPress,
aEvent->mTimeStamp});
if (aPresContext && aPresContext->GetRootPresContext() &&
aEvent->IsTrusted()) {
nsRefreshDriver* driver =
aPresContext->GetRootPresContext()->RefreshDriver();
if (driver && driver->HasPendingTick()) {
switch (aEvent->mMessage) {
case eKeyPress:
driver->RegisterCompositionPayload(
{layers::CompositionPayloadType::eKeyPress,
aEvent->mTimeStamp});
break;
case eMouseClick: {
if (aEvent->AsMouseEvent()->mInputSource ==
MouseEvent_Binding::MOZ_SOURCE_MOUSE ||
aEvent->AsMouseEvent()->mInputSource ==
MouseEvent_Binding::MOZ_SOURCE_TOUCH) {
driver->RegisterCompositionPayload(
{layers::CompositionPayloadType::eMouseUpFollowedByClick,
aEvent->mTimeStamp});
}
break;
}
default:
break;
}
}
}

Просмотреть файл

@ -2241,6 +2241,11 @@ void RecordCompositionPayloadsPresented(
Telemetry::AccumulateTimeDelta(
mozilla::Telemetry::SCROLL_PRESENT_LATENCY, payload.mTimeStamp,
presented);
} else if (payload.mType ==
CompositionPayloadType::eMouseUpFollowedByClick) {
Telemetry::AccumulateTimeDelta(
mozilla::Telemetry::MOUSEUP_FOLLOWED_BY_CLICK_PRESENT_LATENCY,
payload.mTimeStamp, presented);
}
}
}

Просмотреть файл

@ -423,7 +423,15 @@ MOZ_DEFINE_ENUM_CLASS_WITH_BASE(CompositionPayloadType, uint8_t, (
* A |CompositionPayload| with this type indicates that content was painted
* that will be included in the composition.
*/
eContentPaint
eContentPaint,
/**
* A |CompositionPayload| with this type indicates a mouse up (which caused
* a click to happen) happened before composition and will be used to determine latency
* between mouse up and presentation in
* |mozilla::Telemetry::MOUSEUP_FOLLOWED_BY_CLICK_PRESENT_LATENCY|
*/
eMouseUpFollowedByClick
));
// clang-format on

Просмотреть файл

@ -1714,6 +1714,19 @@
"description": "Time between receiving a keypress event on the event loop and compositing its result onto the screen (ms)",
"bug_numbers": [1506537, 1580077]
},
"MOUSEUP_FOLLOWED_BY_CLICK_PRESENT_LATENCY": {
"record_in_processes": [ "main", "gpu" ],
"products": ["firefox", "geckoview_streaming"],
"alert_emails": [ "perf-telemetry-alerts@mozilla.com", "sefeng@mozilla.com" ],
"expires_in_version": "never",
"kind": "exponential",
"releaseChannelCollection": "opt-out",
"low": 1,
"high": 200000,
"n_buckets": 50,
"description": "Time between receiving a mouseup which follow by a mouseclick on the event loop and compositing its result onto the screen (ms)",
"bug_numbers": [1698643]
},
"SCROLL_PRESENT_LATENCY": {
"record_in_processes": ["main", "gpu"],
"products": ["firefox", "geckoview_streaming"],

Просмотреть файл

@ -1351,6 +1351,22 @@ performance.interaction:
- vchin@mozilla.com
expires: never
mouseup_click_present_latency:
type: timing_distribution
time_unit: millisecond
gecko_datapoint: MOUSEUP_FOLLOWED_BY_CLICK_PRESENT_LATENCY
description: >
Time between receiving a mouseup which follow by a mouseclick
on the event loop and compositing its result onto the screen.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1698643
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1698643#c3
notification_emails:
- perf-telemetry-alerts@mozilla.com
- sefeng@mozilla.com
expires: never
tab_switch_composite:
type: timing_distribution
time_unit: millisecond