Bug 672651 - Track cache init times via telemetry r=jduell
authorTaras Glek <tglek@mozilla.com>
Wed, 20 Jul 2011 17:02:58 -0700
changeset 73129 47c7c675129f98982948a7eb59a9e4903366bc8c
parent 73128 579944e7e8f7ddf261b4886dba9def9790ae64d0
child 73130 e25da7cc7c638799d715c94e2fd009679d786fdf
push id20819
push usermak77@bonardo.net
push dateThu, 21 Jul 2011 12:32:52 +0000
treeherdermozilla-central@036c28e4e0f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs672651
milestone8.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 672651 - Track cache init times via telemetry r=jduell
netwerk/cache/nsDiskCacheDevice.cpp
toolkit/components/telemetry/TelemetryHistograms.h
--- a/netwerk/cache/nsDiskCacheDevice.cpp
+++ b/netwerk/cache/nsDiskCacheDevice.cpp
@@ -76,19 +76,20 @@
 #include "nsIInputStream.h"
 #include "nsIOutputStream.h"
 #include "nsCRT.h"
 #include "nsCOMArray.h"
 #include "nsISimpleEnumerator.h"
 
 #include "mozilla/FunctionTimer.h"
 #include "nsThreadUtils.h"
+#include "mozilla/Telemetry.h"
 
 static const char DISK_CACHE_DEVICE_ID[] = { "disk" };
-
+using namespace mozilla;
 
 /******************************************************************************
  *  nsDiskCacheEvictor
  *
  *  Helper class for nsDiskCacheDevice.
  *
  *****************************************************************************/
 
@@ -975,16 +976,17 @@ nsDiskCacheDevice::EvictEntries(const ch
 
 /**
  *  private methods
  */
 
 nsresult
 nsDiskCacheDevice::OpenDiskCache()
 {
+    Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_OPEN> timer;
     // if we don't have a cache directory, create one and open it
     PRBool exists;
     nsresult rv = mCacheDirectory->Exists(&exists);
     if (NS_FAILED(rv))
         return rv;
 
     PRBool trashing = PR_FALSE;
     if (exists) {
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -99,8 +99,9 @@ HISTOGRAM(HTTP_REQUEST_PER_PAGE_FROM_CAC
 HTTP_HISTOGRAMS(PAGE, "page: ")
 HTTP_HISTOGRAMS(SUB, "subitem: ")
 
 #undef _HTTP_HIST
 #undef HTTP_HISTOGRAMS
 HISTOGRAM(FIND_PLUGINS, 1, 3000, 10, EXPONENTIAL, "Time spent scanning filesystem for plugins (ms)")
 HISTOGRAM(CHECK_JAVA_ENABLED, 1, 3000, 10, EXPONENTIAL, "Time spent checking if Java is enabled (ms)")
 HISTOGRAM(STARTUP_MEASUREMENT_ERRORS, 1, 3, 4, LINEAR, "Flags errors in startup calculation()")
+HISTOGRAM(NETWORK_DISK_CACHE_OPEN, 1, 10000, 10, EXPONENTIAL, "Time spent opening disk cache (ms)")