Bug 1307675 - Part 2: Record telemetry for time to first input. r=baku, data=bsmedberg

This commit is contained in:
William Chen 2016-11-08 11:30:57 -08:00
Родитель 8e941520c1
Коммит aed08c925f
2 изменённых файлов: 51 добавлений и 1 удалений

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

@ -77,6 +77,7 @@
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/ServoRestyleManagerInlines.h"
#include "mozilla/Telemetry.h"
#if defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
@ -1617,6 +1618,15 @@ nsPresContext::RecordInteractionTime(InteractionType aType)
&nsPresContext::mFirstScrollTime
};
// Array of histogram IDs for the different interaction types,
// keyed by InteractionType.
Telemetry::ID histogramIds[] = {
Telemetry::TIME_TO_FIRST_CLICK,
Telemetry::TIME_TO_FIRST_KEY_INPUT,
Telemetry::TIME_TO_FIRST_MOUSE_MOVE,
Telemetry::TIME_TO_FIRST_SCROLL
};
TimeStamp& interactionTime = this->*(
interactionTimes[static_cast<uint32_t>(aType)]);
if (!interactionTime.IsNull()) {
@ -1647,7 +1657,11 @@ nsPresContext::RecordInteractionTime(InteractionType aType)
// Only the top level content pres context reports first interaction
// time to telemetry (if it hasn't already done so).
if (this == topContentPresContext) {
// TODO: Record telemetry. See part 2 patch.
if (Telemetry::CanRecordExtended()) {
double millis = (interactionTime - mFirstPaintTime).ToMilliseconds();
Telemetry::Accumulate(histogramIds[static_cast<uint32_t>(aType)],
millis);
}
} else {
topContentPresContext->RecordInteractionTime(aType);
}

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

@ -10602,6 +10602,42 @@
"n_values": 4,
"description": "Counts the number of asm.js vs WebAssembly modules instanciations, at the time modules are getting instanciated."
},
"TIME_TO_FIRST_CLICK": {
"alert_emails": ["hkirschner@mozilla.com"],
"bug_numbers": [1307675],
"expires_in_version": "58",
"kind": "exponential",
"high": 100000,
"n_buckets": 30,
"description": "Time in milliseconds from first paint to first click per top-level content browsing context."
},
"TIME_TO_FIRST_KEY_INPUT": {
"alert_emails": ["hkirschner@mozilla.com"],
"bug_numbers": [1307675],
"expires_in_version": "58",
"kind": "exponential",
"high": 100000,
"n_buckets": 30,
"description": "Time in milliseconds from first paint to first key input per top-level content browsing context."
},
"TIME_TO_FIRST_MOUSE_MOVE": {
"alert_emails": ["hkirschner@mozilla.com"],
"bug_numbers": [1307675],
"expires_in_version": "58",
"kind": "exponential",
"high": 100000,
"n_buckets": 30,
"description": "Time in milliseconds from first paint to first mouse move per top-level content browsing context."
},
"TIME_TO_FIRST_SCROLL": {
"alert_emails": ["hkirschner@mozilla.com"],
"bug_numbers": [1307675],
"expires_in_version": "58",
"kind": "exponential",
"high": 100000,
"n_buckets": 30,
"description": "Time in milliseconds from first paint to first scroll per top-level content browsing context."
},
"DOCUMENT_WITH_EXPANDED_PRINCIPAL": {
"alert_emails": ["dev-platform@lists.mozilla.org"],
"bug_numbers": [1301123],