Bug 810454: Adds A/B test for preloading cookie db r=ehsan

This commit is contained in:
Aaron Klotz 2013-03-06 12:54:44 -07:00
Родитель 15755dd9f0
Коммит a142ca4f0c
2 изменённых файлов: 27 добавлений и 0 удалений

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

@ -48,6 +48,8 @@
#include "nsNetCID.h"
#include "mozilla/storage.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Telemetry.h"
#include "nsIAppsService.h"
#include "mozIApplication.h"
@ -779,12 +781,23 @@ nsCookieService::TryInitDB(bool aRecreateDB)
NS_ENSURE_SUCCESS(rv, RESULT_FAILURE);
}
Telemetry::ID histID;
TimeStamp start = TimeStamp::Now();
// rand() is being used here as a poor-man's solution for a/b testing
if (rand() % 2) {
histID = Telemetry::MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS;
ReadAheadFile(mDefaultDBState->cookieFile);
} else {
histID = Telemetry::MOZ_SQLITE_COOKIES_OPEN_MS;
}
// open a connection to the cookie database, and only cache our connection
// and statements upon success. The connection is opened unshared to eliminate
// cache contention between the main and background threads.
rv = mStorageService->OpenUnsharedDatabase(mDefaultDBState->cookieFile,
getter_AddRefs(mDefaultDBState->dbConn));
NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
Telemetry::AccumulateDelta_impl<Telemetry::Millisecond>::compute(histID, start);
// Set up our listeners.
mDefaultDBState->insertListener = new InsertCookieDBListener(mDefaultDBState);

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

@ -1665,6 +1665,20 @@
"extended_statistics_ok": true,
"description": "Time spent on SQLite read() (ms)"
},
"MOZ_SQLITE_COOKIES_OPEN_MS": {
"kind": "exponential",
"high": "3000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Time spent on cookie DB open (ms)"
},
"MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS": {
"kind": "exponential",
"high": "3000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Time spent on cookie DB open with readahead (ms)"
},
"MOZ_SQLITE_COOKIES_READ_MS": {
"kind": "exponential",
"high": "3000",