Bug 781200 - fixup several cache histograms; r=bsmith,hurley
authorNathan Froyd <froydnj@mozilla.com>
Thu, 23 Aug 2012 13:23:03 -0400
changeset 105245 042463c88673b17f7459900cbaee5972987ce41c
parent 105244 43b106855cbb1941bd5ec5aa1ed0826412251601
child 105246 b88ccf7bd3e32478fc8c26d2cb7631a53a21dbcb
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersbsmith, hurley
bugs781200
milestone17.0a1
Bug 781200 - fixup several cache histograms; r=bsmith,hurley
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsDiskCacheDevice.cpp
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cache/nsMemoryCacheDevice.cpp
toolkit/components/telemetry/TelemetryHistograms.h
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -2132,17 +2132,17 @@ nsCacheService::ActivateEntry(nsCacheReq
     delete entry;
     return rv;
 }
 
 
 nsCacheEntry *
 nsCacheService::SearchCacheDevices(nsCString * key, nsCacheStoragePolicy policy, bool *collision)
 {
-    Telemetry::AutoTimer<Telemetry::CACHE_DEVICE_SEARCH> timer;
+    Telemetry::AutoTimer<Telemetry::CACHE_DEVICE_SEARCH_2> timer;
     nsCacheEntry * entry = nullptr;
 
     CACHE_LOG_DEBUG(("mMemoryDevice: 0x%p\n", mMemoryDevice));
 
     *collision = false;
     if ((policy == nsICache::STORE_ANYWHERE) || (policy == nsICache::STORE_IN_MEMORY)) {
         // If there is no memory device, then there is nothing to search...
         if (mMemoryDevice) {
@@ -2587,20 +2587,20 @@ nsCacheService::OnDataSizeChange(nsCache
 void
 nsCacheService::Lock(mozilla::Telemetry::ID mainThreadLockerID)
 {
     mozilla::Telemetry::ID lockerID;
     mozilla::Telemetry::ID generalID;
 
     if (NS_IsMainThread()) {
         lockerID = mainThreadLockerID;
-        generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD;
+        generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_2;
     } else {
         lockerID = mozilla::Telemetry::HistogramCount;
-        generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT;
+        generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_2;
 	}
 
     TimeStamp start(TimeStamp::Now());
 
     gService->mLock.Lock();
 
     TimeStamp stop(TimeStamp::Now());
 
--- a/netwerk/cache/nsDiskCacheDevice.cpp
+++ b/netwerk/cache/nsDiskCacheDevice.cpp
@@ -471,17 +471,17 @@ nsDiskCacheDevice::GetDeviceID()
  *              key not in disk cache, hash number used
  *              key in disk cache
  *
  *  NOTE: called while holding the cache service lock
  */
 nsCacheEntry *
 nsDiskCacheDevice::FindEntry(nsCString * key, bool *collision)
 {
-    Telemetry::AutoTimer<Telemetry::CACHE_DISK_SEARCH> timer;
+    Telemetry::AutoTimer<Telemetry::CACHE_DISK_SEARCH_2> timer;
     if (!Initialized())  return nullptr;  // NS_ERROR_NOT_INITIALIZED
     if (mClearingDiskCache)  return nullptr;
     nsDiskCacheRecord       record;
     nsDiskCacheBinding *    binding = nullptr;
     PLDHashNumber           hashNumber = nsDiskCache::Hash(key->get());
 
     *collision = false;
 
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -1359,17 +1359,17 @@ const char *
 nsOfflineCacheDevice::GetDeviceID()
 {
   return OFFLINE_CACHE_DEVICE_ID;
 }
 
 nsCacheEntry *
 nsOfflineCacheDevice::FindEntry(nsCString *fullKey, bool *collision)
 {
-  mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_OFFLINE_SEARCH> timer;
+  mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_OFFLINE_SEARCH_2> timer;
   LOG(("nsOfflineCacheDevice::FindEntry [key=%s]\n", fullKey->get()));
 
   // SELECT * FROM moz_cache WHERE key = ?
 
   // Decompose the key into "ClientID" and "Key"
   nsCAutoString keyBuf;
   const char *cid, *key;
   if (!DecomposeCacheEntryKey(fullKey, &cid, &key, keyBuf))
--- a/netwerk/cache/nsMemoryCacheDevice.cpp
+++ b/netwerk/cache/nsMemoryCacheDevice.cpp
@@ -105,17 +105,17 @@ nsMemoryCacheDevice::GetDeviceID()
 {
     return gMemoryDeviceID;
 }
 
 
 nsCacheEntry *
 nsMemoryCacheDevice::FindEntry(nsCString * key, bool *collision)
 {
-    mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_MEMORY_SEARCH> timer;
+    mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_MEMORY_SEARCH_2> timer;
     nsCacheEntry * entry = mMemCacheEntries.GetEntry(key);
     if (!entry)  return nullptr;
 
     // move entry to the tail of an eviction list
     PR_REMOVE_AND_INIT_LINK(entry);
     PR_APPEND_LINK(entry, &mEvictionList[EvictionList(entry, 0)]);
     
     mInactiveSize -= entry->DataSize();
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -195,31 +195,31 @@ HISTOGRAM(SPDY_SETTINGS_RTT, 1, 1000, 10
 HISTOGRAM(SPDY_SETTINGS_MAX_STREAMS, 1, 5000, 100, EXPONENTIAL,  "SPDY: Settings Max Streams parameter")
 HISTOGRAM(SPDY_SETTINGS_CWND, 1, 500, 50, EXPONENTIAL,  "SPDY: Settings CWND (packets)")
 HISTOGRAM(SPDY_SETTINGS_RETRANS, 1, 100, 50, EXPONENTIAL,  "SPDY: Retransmission Rate")
 HISTOGRAM(SPDY_SETTINGS_IW, 1, 1000, 50, EXPONENTIAL,  "SPDY: Settings IW (rounded to KB)")
 
 #undef _HTTP_HIST
 #undef HTTP_HISTOGRAMS
 
-HISTOGRAM(DISK_CACHE_CORRUPT_DETAILS, 1, 50, 51, LINEAR, "Why the HTTP disk cache was corrupted at startup")
+HISTOGRAM_ENUMERATED_VALUES(DISK_CACHE_CORRUPT_DETAILS, 50, "Why the HTTP disk cache was corrupted at startup")
 HISTOGRAM_BOOLEAN(DISK_CACHE_REDUCTION_TRIAL, "Stores 1 if the cache would be corrupted with the disk cache corruption plan of Bug 105843")
 HISTOGRAM_ENUMERATED_VALUES(HTTP_CACHE_DISPOSITION_2,         5, "HTTP Cache Hit, Reval, Failed-Reval, Miss")
 HISTOGRAM_ENUMERATED_VALUES(HTTP_DISK_CACHE_DISPOSITION_2,    5, "HTTP Disk Cache Hit, Reval, Failed-Reval, Miss")
 HISTOGRAM_ENUMERATED_VALUES(HTTP_MEMORY_CACHE_DISPOSITION_2,  5, "HTTP Memory Cache Hit, Reval, Failed-Reval, Miss")
 HISTOGRAM_ENUMERATED_VALUES(HTTP_OFFLINE_CACHE_DISPOSITION_2, 5, "HTTP Offline Cache Hit, Reval, Failed-Reval, Miss")
-HISTOGRAM(CACHE_DEVICE_SEARCH, 1, 100, 100, LINEAR, "Time to search cache (ms)")
-HISTOGRAM(CACHE_MEMORY_SEARCH, 1, 100, 100, LINEAR, "Time to search memory cache (ms)")
-HISTOGRAM(CACHE_DISK_SEARCH, 1, 100, 100, LINEAR, "Time to search disk cache (ms)")
-HISTOGRAM(CACHE_OFFLINE_SEARCH, 1, 100, 100, LINEAR, "Time to search offline cache (ms)")
+HISTOGRAM(CACHE_DEVICE_SEARCH_2, 1, 10000, 50, EXPONENTIAL, "Time to search cache (ms)")
+HISTOGRAM(CACHE_MEMORY_SEARCH_2, 1, 10000, 50, EXPONENTIAL, "Time to search memory cache (ms)")
+HISTOGRAM(CACHE_DISK_SEARCH_2, 1, 10000, 50, EXPONENTIAL, "Time to search disk cache (ms)")
+HISTOGRAM(CACHE_OFFLINE_SEARCH_2, 1, 10000, 50, EXPONENTIAL, "Time to search offline cache (ms)")
 HISTOGRAM(HTTP_DISK_CACHE_OVERHEAD, 1, 32000000, 100, EXPONENTIAL, "HTTP Disk cache memory overhead (bytes)")
-HISTOGRAM(CACHE_LM_INCONSISTENT, 0, 1, 2, BOOLEAN,  "Cache discovered inconsistent last-modified entry")
-HISTOGRAM(CACHE_SERVICE_LOCK_WAIT, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock (ms)")
-HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock on the main thread (ms)")
-HISTOGRAM(DISK_CACHE_SMART_SIZE_USING_OLD_MAX, 0, 1, 2, BOOLEAN, "Whether we are using the old default cache smart size")
+HISTOGRAM_BOOLEAN(CACHE_LM_INCONSISTENT, "Cache discovered inconsistent last-modified entry")
+HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_2, 1, 10000, 50, EXPONENTIAL, "Time spent waiting on the cache service lock (ms)")
+HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_2, 1, 10000, 50, EXPONENTIAL, "Time spent waiting on the cache service lock on the main thread (ms)")
+HISTOGRAM_BOOLEAN(DISK_CACHE_SMART_SIZE_USING_OLD_MAX, "Whether we are using the old default cache smart size")
 
 #define CACHE_LOCK_HISTOGRAM(x) \
   HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_##x, 1, 10 * 1000, 50, EXPONENTIAL, "Time spent waiting on the cache service lock (ms) on the main thread in " #x)
 
 CACHE_LOCK_HISTOGRAM(NSSETDISKSMARTSIZECALLBACK_NOTIFY)
 CACHE_LOCK_HISTOGRAM(NSPROCESSREQUESTEVENT_RUN)
 CACHE_LOCK_HISTOGRAM(NSOUTPUTSTREAMWRAPPER_LAZYINIT)
 CACHE_LOCK_HISTOGRAM(NSOUTPUTSTREAMWRAPPER_CLOSE)