Bug 1481716 - Add a telemetry probe to track how long does the QM take for initializing repositories; r=janv, data-review=francois
authorTom Tung <shes050117@gmail.com>
Mon, 13 Aug 2018 10:34:10 +0200
changeset 499921 daed617054ce114772d208c79bbe8cd8d858d310
parent 499920 2e32d6dc9d1e65682d0b1eecbde3564ec0c39fc5
child 499922 085738995db1c63fd00b3ddec8f084190833eb0a
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1481716
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481716 - Add a telemetry probe to track how long does the QM take for initializing repositories; r=janv, data-review=francois This patch adds a telemetry probe to track the time for initializing both the default and the temporary repositories.
dom/quota/ActorsParent.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -24,16 +24,17 @@
 #include "nsIURI.h"
 #include "nsPIDOMWindow.h"
 
 #include <algorithm>
 #include "GeckoProfiler.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/CondVar.h"
+#include "mozilla/Telemetry.h"
 #include "mozilla/dom/PContent.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/QuotaClient.h"
 #include "mozilla/dom/indexedDB/ActorsParent.h"
 #include "mozilla/dom/quota/PQuotaParent.h"
 #include "mozilla/dom/quota/PQuotaRequestParent.h"
 #include "mozilla/dom/quota/PQuotaUsageRequestParent.h"
 #include "mozilla/dom/simpledb/ActorsParent.h"
@@ -5409,32 +5410,38 @@ QuotaManager::EnsureTemporaryStorageIsIn
 {
   AssertIsOnIOThread();
   MOZ_ASSERT(mStorageInitialized);
 
   if (mTemporaryStorageInitialized) {
     return NS_OK;
   }
 
+  TimeStamp startTime = TimeStamp::Now();
+
   nsresult rv = InitializeRepository(PERSISTENCE_TYPE_DEFAULT);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     // We have to cleanup partially initialized quota.
     RemoveQuota();
 
     return rv;
   }
 
   rv = InitializeRepository(PERSISTENCE_TYPE_TEMPORARY);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     // We have to cleanup partially initialized quota.
     RemoveQuota();
 
     return rv;
   }
 
+  Telemetry::AccumulateTimeDelta(Telemetry::QM_REPOSITORIES_INITIALIZATION_TIME,
+                                 startTime,
+                                 TimeStamp::Now());
+
   if (gFixedLimitKB >= 0) {
     mTemporaryStorageLimit = static_cast<uint64_t>(gFixedLimitKB) * 1024;
   } else {
     nsCOMPtr<nsIFile> storageDir =
       do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -14146,10 +14146,21 @@
     ],
     "expires_in_version": "69",
     "kind": "linear",
     "high": 60,
     "n_buckets": 10,
     "bug_numbers": [1490074],
     "description": "How long the AudioContext would become audible since it was created, time unit is seconds.",
     "releaseChannelCollection": "opt-out"
+  },
+  "QM_REPOSITORIES_INITIALIZATION_TIME": {
+    "record_in_processes": ["main"],
+    "expires_in_version": "68",
+    "bug_numbers": [1481716],
+    "kind": "exponential",
+    "high": 30000,
+    "n_buckets": 30,
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["ttung@mozilla.com"],
+    "description": "Time (ms) for the QuotaManager to initialize repositories."
   }
 }