Bug 764905 - Randomly flip preload on/off, independent of whether update service deleted prefetch. r=taras

This commit is contained in:
Brian R. Bondy 2012-06-16 13:44:07 -04:00
parent 8a1955f45f
commit 1fef2f3064
2 changed files with 25 additions and 8 deletions

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include "nsCOMPtr.h"
#include "nsIFile.h"
@ -241,18 +242,34 @@ int main(int argc, char* argv[])
#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 };
PreloadReason preloadReason = PRELOAD_NONE;
// STARTUP_USING_PRELOAD_TRIAL histogram.
enum PreloadType{ PREFETCH_PRELOAD,
PREFETCH_NO_PRELOAD,
NO_PREFETCH_PRELOAD,
NO_PREFETCH_NO_PRELOAD };
PreloadType preloadType;
IO_COUNTERS ioCounters;
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
srand(time(NULL));
bool shouldUsePreload = rand() % 2 == 0;
if (IsPrefetchDisabledViaService()) {
preloadReason = PRELOAD_SERVICE;
if (shouldUsePreload) {
preloadType = NO_PREFETCH_PRELOAD;
} else {
preloadType = NO_PREFETCH_NO_PRELOAD;
}
} else {
if (shouldUsePreload) {
preloadType = PREFETCH_PRELOAD;
} else {
preloadType = PREFETCH_NO_PRELOAD;
}
}
if (preloadReason != PRELOAD_NONE)
if (shouldUsePreload)
#endif
{
XPCOMGlueEnablePreload();
@ -279,8 +296,8 @@ int main(int argc, char* argv[])
#endif
#if defined(XP_WIN)
XRE_TelemetryAccumulate(mozilla::Telemetry::STARTUP_USING_PRELOAD,
preloadReason);
XRE_TelemetryAccumulate(mozilla::Telemetry::STARTUP_USING_PRELOAD_TRIAL,
preloadType);
#endif
if (gotCounters) {

View File

@ -85,7 +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")
HISTOGRAM(STARTUP_USING_PRELOAD_TRIAL, 1, 3, 4, LINEAR, "Preload heuristic. 0: prefetch, preload, 1: prefetch, no preload, 2: no prefetch, preload, 3: no prefetch, no preload")
#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")