Bug 758206 - Telemetry for preload/prefetch. r=taras

This commit is contained in:
Brian R. Bondy 2012-05-27 22:40:49 -04:00
Родитель 0f82ace676
Коммит 94c46ab6f0
2 изменённых файлов: 20 добавлений и 3 удалений

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

@ -214,6 +214,12 @@ int main(int argc, char* argv[])
struct rusage initialRUsage;
gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
#elif defined(XP_WIN)
// Don't change the order of these enumeration constants, the order matters
// for reporting telemetry data. If new values are added adjust the
// STARTUP_USING_PRELOAD histogram.
enum PreloadReason { PRELOAD_NONE, PRELOAD_SERVICE, PRELOAD_IOCOUNT };
PreloadReason preloadReason = PRELOAD_NONE;
// GetProcessIoCounters().ReadOperationCount seems to have little to
// do with actual read operations. It reports 0 or 1 at this stage
// in the program. Luckily 1 coincides with when prefetch is
@ -224,14 +230,19 @@ int main(int argc, char* argv[])
// files.
IO_COUNTERS ioCounters;
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
if ((gotCounters && !ioCounters.ReadOperationCount) ||
IsPrefetchDisabledViaService())
if (IsPrefetchDisabledViaService()) {
preloadReason = PRELOAD_SERVICE;
} else if ((gotCounters && !ioCounters.ReadOperationCount)) {
preloadReason = PRELOAD_IOCOUNT;
}
if (preloadReason != PRELOAD_NONE)
#endif
{
XPCOMGlueEnablePreload();
}
rv = XPCOMGlueStartup(exePath);
if (NS_FAILED(rv)) {
Output("Couldn't load XPCOM.\n");
@ -250,6 +261,11 @@ int main(int argc, char* argv[])
XRE_SetupDllBlocklist();
#endif
#if defined(XP_WIN)
XRE_TelemetryAccumulate(mozilla::Telemetry::STARTUP_USING_PRELOAD,
preloadReason);
#endif
if (gotCounters) {
#if defined(XP_WIN)
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,

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

@ -85,6 +85,7 @@ HISTOGRAM(EARLY_GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.Rea
HISTOGRAM(EARLY_GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount before glue startup (KB)")
HISTOGRAM(GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.ReadOperationCount after glue startup")
HISTOGRAM(GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount after glue startup (KB)")
HISTOGRAM(STARTUP_USING_PRELOAD, 1, 2, 3, LINEAR, "Preload heuristic. 0: none, 1: preload from service, 2: preload from ioCounters.ReadOperationCount")
#elif defined(XP_UNIX)
HISTOGRAM(EARLY_GLUESTARTUP_HARD_FAULTS, 1, 100, 12, LINEAR, "Hard faults count before glue startup")
HISTOGRAM(GLUESTARTUP_HARD_FAULTS, 1, 500, 12, EXPONENTIAL, "Hard faults count after glue startup")