Bug 1281793 - Remove some non-used telemetry IDs - part 2 - network/cache, r=gfritzsche
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 28 Jun 2016 19:29:28 +0200
changeset 302981 33d663a3d351217ee7cdabe86388c2b199a1bc6e
parent 302980 b022cc28da9b738a9a8d579c2f4dd81429b514da
child 302982 dff93c4f631d2182216912fc434c3db993c6405e
push id30379
push usercbook@mozilla.com
push dateWed, 29 Jun 2016 14:13:35 +0000
treeherdermozilla-central@b69a5bbb5e40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1281793
milestone50.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 1281793 - Remove some non-used telemetry IDs - part 2 - network/cache, r=gfritzsche
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsDiskCacheDevice.cpp
netwerk/cache/nsDiskCacheMap.cpp
netwerk/cache/nsDiskCacheMap.h
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/histogram-whitelists.json
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1612,19 +1612,16 @@ nsCacheService::CreateDiskDevice()
         printf("###\n");
 #endif
         mEnableDiskDevice = false;
         delete mDiskDevice;
         mDiskDevice = nullptr;
         return rv;
     }
 
-    Telemetry::Accumulate(Telemetry::DISK_CACHE_SMART_SIZE_USING_OLD_MAX,
-                          mObserver->ShouldUseOldMaxSmartSize());
-
     NS_ASSERTION(!mSmartSizeTimer, "Smartsize timer was already fired!");
 
     // Disk device is usually created during the startup. Delay smart size
     // calculation to avoid possible massive IO caused by eviction of entries
     // in case the new smart size is smaller than current cache usage.
     mSmartSizeTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
     if (NS_SUCCEEDED(rv)) {
         rv = mSmartSizeTimer->InitWithCallback(new nsSetDiskSmartSizeCallback(),
--- a/netwerk/cache/nsDiskCacheDevice.cpp
+++ b/netwerk/cache/nsDiskCacheDevice.cpp
@@ -960,27 +960,22 @@ nsDiskCacheDevice::OpenDiskCache()
     bool exists;
     nsresult rv = mCacheDirectory->Exists(&exists);
     if (NS_FAILED(rv))
         return rv;
 
     if (exists) {
         // Try opening cache map file.
         nsDiskCache::CorruptCacheInfo corruptInfo;
-        rv = mCacheMap.Open(mCacheDirectory, &corruptInfo, true);
+        rv = mCacheMap.Open(mCacheDirectory, &corruptInfo);
 
-        if (NS_SUCCEEDED(rv)) {
-            Telemetry::Accumulate(Telemetry::DISK_CACHE_CORRUPT_DETAILS,
-                                  corruptInfo);
-        } else if (rv == NS_ERROR_ALREADY_INITIALIZED) {
+        if (rv == NS_ERROR_ALREADY_INITIALIZED) {
           NS_WARNING("nsDiskCacheDevice::OpenDiskCache: already open!");
-        } else {
+        } else if (NS_FAILED(rv)) {
             // Consider cache corrupt: delete it
-            Telemetry::Accumulate(Telemetry::DISK_CACHE_CORRUPT_DETAILS,
-                                  corruptInfo);
             // delay delete by 1 minute to avoid IO thrash at startup
             rv = nsDeleteDir::DeleteDir(mCacheDirectory, true, 60000);
             if (NS_FAILED(rv))
                 return rv;
             exists = false;
         }
     }
 
@@ -990,17 +985,17 @@ nsDiskCacheDevice::OpenDiskCache()
         rv = mCacheDirectory->Create(nsIFile::DIRECTORY_TYPE, 0777);
         CACHE_LOG_PATH(LogLevel::Info, "\ncreate cache directory: %s\n", mCacheDirectory);
         CACHE_LOG_INFO(("mCacheDirectory->Create() = %x\n", rv));
         if (NS_FAILED(rv))
             return rv;
     
         // reopen the cache map     
         nsDiskCache::CorruptCacheInfo corruptInfo;
-        rv = mCacheMap.Open(mCacheDirectory, &corruptInfo, false);
+        rv = mCacheMap.Open(mCacheDirectory, &corruptInfo);
         if (NS_FAILED(rv))
             return rv;
     }
 
     return NS_OK;
 }
 
 
--- a/netwerk/cache/nsDiskCacheMap.cpp
+++ b/netwerk/cache/nsDiskCacheMap.cpp
@@ -29,18 +29,17 @@ using namespace mozilla;
  *****************************************************************************/
 
 /**
  *  File operations
  */
 
 nsresult
 nsDiskCacheMap::Open(nsIFile *  cacheDirectory,
-                     nsDiskCache::CorruptCacheInfo *  corruptInfo,
-                     bool reportCacheCleanTelemetryData)
+                     nsDiskCache::CorruptCacheInfo *  corruptInfo)
 {
     NS_ENSURE_ARG_POINTER(corruptInfo);
 
     // Assume we have an unexpected error until we find otherwise.
     *corruptInfo = nsDiskCache::kUnexpectedError;
     NS_ENSURE_ARG_POINTER(cacheDirectory);
     if (mMapFD)  return NS_ERROR_ALREADY_INITIALIZED;
 
@@ -61,18 +60,17 @@ nsDiskCacheMap::Open(nsIFile *  cacheDir
         return NS_ERROR_FILE_CORRUPTED;
     }
 
     bool cacheFilesExist = CacheFilesExist();
     rv = NS_ERROR_FILE_CORRUPTED;  // presume the worst
     uint32_t mapSize = PR_Available(mMapFD);    
 
     if (NS_FAILED(InitCacheClean(cacheDirectory,
-                                 corruptInfo,
-                                 reportCacheCleanTelemetryData))) {
+                                 corruptInfo))) {
         // corruptInfo is set in the call to InitCacheClean
         goto error_exit;
     }
 
     // check size of map file
     if (mapSize == 0) {  // creating a new _CACHE_MAP_
 
         // block files shouldn't exist if we're creating the _CACHE_MAP_
@@ -1233,18 +1231,17 @@ nsDiskCacheMap::SizeOfExcludingThis(Mall
     usage += mBlockFile[i].SizeOfExcludingThis(aMallocSizeOf);
   }
 
   return usage;
 }
 
 nsresult
 nsDiskCacheMap::InitCacheClean(nsIFile *  cacheDirectory,
-                               nsDiskCache::CorruptCacheInfo *  corruptInfo,
-                               bool reportCacheCleanTelemetryData)
+                               nsDiskCache::CorruptCacheInfo *  corruptInfo)
 {
     // The _CACHE_CLEAN_ file will be used in the future to determine
     // if the cache is clean or not. 
     bool cacheCleanFileExists = false;
     nsCOMPtr<nsIFile> cacheCleanFile;
     nsresult rv = cacheDirectory->GetParent(getter_AddRefs(cacheCleanFile));
     if (NS_SUCCEEDED(rv)) {
         rv = cacheCleanFile->AppendNative(
@@ -1270,19 +1267,16 @@ nsDiskCacheMap::InitCacheClean(nsIFile *
         return rv;
     }
 
     if (cacheCleanFileExists) {
         char clean = '0';
         int32_t bytesRead = PR_Read(mCleanFD, &clean, 1);
         if (bytesRead != 1) {
             NS_WARNING("Could not read _CACHE_CLEAN_ file contents");
-        } else if (reportCacheCleanTelemetryData) {
-            Telemetry::Accumulate(Telemetry::DISK_CACHE_REDUCTION_TRIAL,
-                                  clean == '1' ? 1 : 0);
         }
     }
 
     // Create a timer that will be used to validate the cache
     // as long as an activity threshold was met
     mCleanCacheTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
     if (NS_SUCCEEDED(rv)) {
         mCleanCacheTimer->SetTarget(nsCacheService::GlobalInstance()->mCacheIOThread);
@@ -1335,21 +1329,19 @@ nsDiskCacheMap::InvalidateCache()
 {
     nsCacheService::AssertOwnsLock();
     CACHE_LOG_DEBUG(("CACHE: InvalidateCache\n"));
     nsresult rv;
   
     if (!mIsDirtyCacheFlushed) {
         rv = WriteCacheClean(false);
         if (NS_FAILED(rv)) {
-          Telemetry::Accumulate(Telemetry::DISK_CACHE_INVALIDATION_SUCCESS, 0);
           return rv;
         }
 
-        Telemetry::Accumulate(Telemetry::DISK_CACHE_INVALIDATION_SUCCESS, 1);
         mIsDirtyCacheFlushed = true;
     }
 
     rv = ResetCacheTimer();
     NS_ENSURE_SUCCESS(rv, rv);
 
     return NS_OK;
 }
@@ -1409,38 +1401,33 @@ nsDiskCacheMap::IsCacheInSafeState()
 
 nsresult
 nsDiskCacheMap::RevalidateCache()
 {
     CACHE_LOG_DEBUG(("CACHE: RevalidateCache\n"));
     nsresult rv;
 
     if (!IsCacheInSafeState()) {
-        Telemetry::Accumulate(Telemetry::DISK_CACHE_REVALIDATION_SAFE, 0);
         CACHE_LOG_DEBUG(("CACHE: Revalidation should not performed because "
                          "cache not in a safe state\n"));
         // Normally we would return an error here, but there is a bug where
         // the doom list sometimes gets an entry 'stuck' and doens't clear it
         // until browser shutdown.  So we allow revalidation for the time being
         // to get proper telemetry data of how much the cache corruption plan
         // would help.
-    } else {
-        Telemetry::Accumulate(Telemetry::DISK_CACHE_REVALIDATION_SAFE, 1);
     }
 
     // We want this after the lock to prove that flushing a file isn't that expensive
     Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_REVALIDATION> totalTimer;
 
     // If telemetry data shows it is worth it, we'll be flushing headers and
     // records before flushing the clean cache file.
   
     // Write out the _CACHE_CLEAN_ file with '1'
     rv = WriteCacheClean(true);
     if (NS_FAILED(rv)) {
-        Telemetry::Accumulate(Telemetry::DISK_CACHE_REVALIDATION_SUCCESS, 0);
         return rv;
     }
 
-    Telemetry::Accumulate(Telemetry::DISK_CACHE_REVALIDATION_SUCCESS, 1);
     mIsDirtyCacheFlushed = false;
 
     return NS_OK;
 }
--- a/netwerk/cache/nsDiskCacheMap.h
+++ b/netwerk/cache/nsDiskCacheMap.h
@@ -403,18 +403,17 @@ public:
  *  File Operations
  *
  *  Open
  *
  *  Creates a new cache map file if one doesn't exist.
  *  Returns error if it detects change in format or cache wasn't closed.
  */
     nsresult  Open( nsIFile *  cacheDirectory,
-                    nsDiskCache::CorruptCacheInfo *  corruptInfo,
-                    bool reportCacheCleanTelemetryData);
+                    nsDiskCache::CorruptCacheInfo *  corruptInfo);
     nsresult  Close(bool flush);
     nsresult  Trim();
 
     nsresult  FlushHeader();
     nsresult  FlushRecords( bool unswap);
 
     void      NotifyCapacityChange(uint32_t capacity);
 
@@ -537,18 +536,17 @@ private:
 
     // The returned structure will point to the buffer owned by nsDiskCacheMap, 
     // so it must not be deleted by the caller.
     nsDiskCacheEntry *  CreateDiskCacheEntry(nsDiskCacheBinding *  binding,
                                              uint32_t * size);
 
     // Initializes the _CACHE_CLEAN_ related functionality
     nsresult InitCacheClean(nsIFile *  cacheDirectory,
-                            nsDiskCache::CorruptCacheInfo *  corruptInfo,
-                            bool reportCacheCleanTelemetryData);
+                            nsDiskCache::CorruptCacheInfo *  corruptInfo);
     // Writes out a value of '0' or '1' in the _CACHE_CLEAN_ file
     nsresult WriteCacheClean(bool clean);
     // Resets the timout for revalidating the cache
     nsresult ResetCacheTimer(int32_t timeout = kRevalidateCacheTimeout);
     // Invalidates the cache, calls WriteCacheClean and ResetCacheTimer
     nsresult InvalidateCache();
     // Determines if the cache is in a safe state
     bool IsCacheInSafeState();
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -1667,42 +1667,16 @@
     "n_values": 32,
     "description": "H2: goaway reason from peer from rfc 7540. 31 is none received."
   },
   "HTTP_CONNECTION_ENTRY_CACHE_HIT_1" : {
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "Fraction of sockets that used a nsConnectionEntry with history - size 300."
   },
-  "DISK_CACHE_CORRUPT_DETAILS": {
-    "expires_in_version": "40",
-    "kind": "enumerated",
-    "n_values": 50,
-    "description": "Why the HTTP disk cache was corrupted at startup"
-  },
-  "DISK_CACHE_REDUCTION_TRIAL": {
-    "expires_in_version": "40",
-    "kind": "boolean",
-    "description": "Stores 1 if the cache would be clean with the disk cache corruption plan of Bug 105843"
-  },
-  "DISK_CACHE_REVALIDATION_SAFE": {
-    "expires_in_version": "40",
-    "kind": "boolean",
-    "description": "Stores 1 if the cache clean file was revalidated, or 0 if a non empty doom list prevented revalidation"
-  },
-  "DISK_CACHE_INVALIDATION_SUCCESS": {
-    "expires_in_version": "40",
-    "kind": "boolean",
-    "description": "Stores 1 if writing '0' to the cache clean file succeeded, and 0 if it failed."
-  },
-  "DISK_CACHE_REVALIDATION_SUCCESS": {
-    "expires_in_version": "40",
-    "kind": "boolean",
-    "description": "Stores 1 if writing '1' to the cache clean file succeeded, and 0 if it failed."
-  },
   "HTTP_CACHE_DISPOSITION_2": {
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 5,
     "description": "HTTP Cache Hit, Reval, Failed-Reval, Miss"
   },
   "HTTP_CACHE_DISPOSITION_2_V2": {
     "expires_in_version": "never",
@@ -1841,21 +1815,16 @@
   },
   "CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_2": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 50,
     "description": "Time spent waiting on the cache service lock on the main thread (ms)"
   },
-  "DISK_CACHE_SMART_SIZE_USING_OLD_MAX": {
-    "expires_in_version": "40",
-    "kind": "boolean",
-    "description": "Whether we are using the old default cache smart size"
-  },
   "CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_NSSETDISKSMARTSIZECALLBACK_NOTIFY": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 50,
     "description": "Time spent waiting on the cache service lock (ms) on the main thread in NSSETDISKSMARTSIZECALLBACK_NOTIFY"
   },
   "CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_NSPROCESSREQUESTEVENT_RUN": {
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -377,22 +377,16 @@
     "DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_BOOLEAN",
     "DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_PER_USER_FLAG",
     "DEVTOOLS_WEBIDE_PROJECT_EDITOR_TIME_ACTIVE_SECONDS",
     "DEVTOOLS_WEBIDE_REMOTE_CONNECTION_RESULT",
     "DEVTOOLS_WEBIDE_SIMULATOR_CONNECTION_RESULT",
     "DEVTOOLS_WEBIDE_TIME_ACTIVE_SECONDS",
     "DEVTOOLS_WEBIDE_USB_CONNECTION_RESULT",
     "DEVTOOLS_WEBIDE_WIFI_CONNECTION_RESULT",
-    "DISK_CACHE_CORRUPT_DETAILS",
-    "DISK_CACHE_INVALIDATION_SUCCESS",
-    "DISK_CACHE_REDUCTION_TRIAL",
-    "DISK_CACHE_REVALIDATION_SAFE",
-    "DISK_CACHE_REVALIDATION_SUCCESS",
-    "DISK_CACHE_SMART_SIZE_USING_OLD_MAX",
     "DISPLAY_SCALING_LINUX",
     "DISPLAY_SCALING_MSWIN",
     "DISPLAY_SCALING_OSX",
     "DNS_BLACKLIST_COUNT",
     "DNS_CLEANUP_AGE",
     "DNS_FAILED_LOOKUP_TIME",
     "DNS_LOOKUP_METHOD2",
     "DNS_LOOKUP_TIME",
@@ -1468,22 +1462,16 @@
     "DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_BOOLEAN",
     "DEVTOOLS_WEBIDE_PROJECT_EDITOR_SAVE_PER_USER_FLAG",
     "DEVTOOLS_WEBIDE_PROJECT_EDITOR_TIME_ACTIVE_SECONDS",
     "DEVTOOLS_WEBIDE_REMOTE_CONNECTION_RESULT",
     "DEVTOOLS_WEBIDE_SIMULATOR_CONNECTION_RESULT",
     "DEVTOOLS_WEBIDE_TIME_ACTIVE_SECONDS",
     "DEVTOOLS_WEBIDE_USB_CONNECTION_RESULT",
     "DEVTOOLS_WEBIDE_WIFI_CONNECTION_RESULT",
-    "DISK_CACHE_CORRUPT_DETAILS",
-    "DISK_CACHE_INVALIDATION_SUCCESS",
-    "DISK_CACHE_REDUCTION_TRIAL",
-    "DISK_CACHE_REVALIDATION_SAFE",
-    "DISK_CACHE_REVALIDATION_SUCCESS",
-    "DISK_CACHE_SMART_SIZE_USING_OLD_MAX",
     "DISPLAY_SCALING_LINUX",
     "DISPLAY_SCALING_MSWIN",
     "DISPLAY_SCALING_OSX",
     "DNS_BLACKLIST_COUNT",
     "DNS_CLEANUP_AGE",
     "DNS_FAILED_LOOKUP_TIME",
     "DNS_LOOKUP_METHOD2",
     "DNS_LOOKUP_TIME",