bug 1101194 - add telemetry for DataStorage table size r=mgoodwin
authorDavid Keeler <dkeeler@mozilla.com>
Wed, 07 Jan 2015 13:23:07 -0800
changeset 248627 95d32869e77fdbf8c9d386097db87c4dd49f984a
parent 248626 cf207a98cbb9aacbbb472ece1d136504966cfcc9
child 248628 204c0dfa5e0bcccb26dc5e94c5c0136d70adb12d
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgoodwin
bugs1101194
milestone37.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 1101194 - add telemetry for DataStorage table size r=mgoodwin
security/manager/boot/src/DataStorage.cpp
toolkit/components/telemetry/Histograms.json
--- a/security/manager/boot/src/DataStorage.cpp
+++ b/security/manager/boot/src/DataStorage.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DataStorage.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
+#include "mozilla/Telemetry.h"
 #include "mozilla/unused.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsIObserverService.h"
 #include "nsITimer.h"
 #include "nsNetUtil.h"
 #include "nsStreamUtils.h"
 #include "nsThreadUtils.h"
@@ -105,16 +106,22 @@ private:
   static nsresult ParseLine(nsDependentCSubstring& aLine, nsCString& aKeyOut,
                             Entry& aEntryOut);
 
   nsRefPtr<DataStorage> mDataStorage;
 };
 
 DataStorage::Reader::~Reader()
 {
+  {
+    MutexAutoLock lock(mDataStorage->mMutex);
+    Telemetry::Accumulate(Telemetry::DATA_STORAGE_ENTRIES,
+                          mDataStorage->mPersistentDataTable.Count());
+  }
+
   // Notify that calls to Get can proceed.
   {
     MonitorAutoLock readyLock(mDataStorage->mReadyMonitor);
     mDataStorage->mReady = true;
     nsresult rv = mDataStorage->mReadyMonitor.NotifyAll();
     unused << NS_WARN_IF(NS_FAILED(rv));
   }
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7064,10 +7064,17 @@
     "keyed": true,
     "description": "Counts of plugin/content process abnormal shutdown, whether or not a crash report was available."
   },
   "SUBPROCESS_CRASHES_WITH_DUMP": {
     "expires_in_version": "never",
     "kind": "count",
     "keyed": true,
     "description": "Counts of plugin and content process crashes which are reported with a crash dump."
+  },
+  "DATA_STORAGE_ENTRIES": {
+    "expires_in_version": "default",
+    "kind": "linear",
+    "high": "1024",
+    "n_buckets": 16,
+    "description": "The number of entries in persistent DataStorage (HSTS and HPKP data, basically)"
   }
 }