diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-22 16:39:34 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-22 16:39:34 +0000 |
commit | 68bf44838715354b7d582e52c93774da38570be0 (patch) | |
tree | 14a32c244e69037c831090f7e7f99cbb02913a79 | |
parent | 99ddc3de904b97133a81099477744f7bf6a452c4 (diff) | |
download | chromium_src-68bf44838715354b7d582e52c93774da38570be0.zip chromium_src-68bf44838715354b7d582e52c93774da38570be0.tar.gz chromium_src-68bf44838715354b7d582e52c93774da38570be0.tar.bz2 |
Time NSS Initialization for slow startups.
Since the code for doing this is outside chrome/ , we can't use the ScopedSlowStartupUMA class, but instead record a regular histogram. If we're experiencing a slow startup, we look up the histogram and set the UMA bit on it.
BUG=160927
Review URL: https://chromiumcodereview.appspot.com/12018019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178018 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/startup_metric_utils.cc | 12 | ||||
-rw-r--r-- | crypto/nss_util.cc | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/chrome/common/startup_metric_utils.cc b/chrome/common/startup_metric_utils.cc index e29aaf2..887a2d2 100644 --- a/chrome/common/startup_metric_utils.cc +++ b/chrome/common/startup_metric_utils.cc @@ -7,6 +7,8 @@ #include "base/hash_tables.h" #include "base/logging.h" #include "base/metrics/histogram.h" +#include "base/metrics/histogram_base.h" +#include "base/metrics/statistics_recorder.h" #include "base/synchronization/lock.h" #include "base/sys_info.h" #include "base/time.h" @@ -90,6 +92,16 @@ void OnBrowserStartupComplete() { const base::TimeDelta kTenSeconds = base::TimeDelta::FromSeconds(10); if (startup_time_from_main_entry < kTenSeconds) return; + + // Set UMA flag for histograms outside chrome/ that can't use the + // ScopedSlowStartupUMA class. + base::Histogram* histogram = + base::StatisticsRecorder::FindHistogram("Startup.SlowStartupNSSInit"); + if (histogram) + histogram->SetFlags(base::HistogramBase::kUmaTargetedHistogramFlag); + + // Iterate over the stats recorded by ScopedSlowStartupUMA and create + // histograms for them. { base::AutoLock locker(*GetSubsystemStartupTimeHashLock()); SubsystemStartupTimeHash* time_hash = GetSubsystemStartupTimeHash(); diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc index 69d74f5..454d539 100644 --- a/crypto/nss_util.cc +++ b/crypto/nss_util.cc @@ -31,6 +31,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/metrics/histogram.h" #include "base/native_library.h" #include "base/stringprintf.h" #include "base/threading/thread_restrictions.h" @@ -428,6 +429,7 @@ class NSSInitSingleton { tpm_slot_(NULL), root_(NULL), chromeos_user_logged_in_(false) { + base::TimeTicks start_time = base::TimeTicks::Now(); EnsureNSPRInit(); // We *must* have NSS >= 3.12.3. See bug 26448. @@ -524,6 +526,14 @@ class NSSInitSingleton { NSS_SetAlgorithmPolicy(SEC_OID_MD5, 0, NSS_USE_ALG_IN_CERT_SIGNATURE); NSS_SetAlgorithmPolicy(SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION, 0, NSS_USE_ALG_IN_CERT_SIGNATURE); + + // The UMA bit is conditionally set for this histogram in + // chrome/common/startup_metric_utils.cc . + HISTOGRAM_CUSTOM_TIMES("Startup.SlowStartupNSSInit", + base::TimeTicks::Now() - start_time, + base::TimeDelta::FromMilliseconds(10), + base::TimeDelta::FromHours(1), + 50); } // NOTE(willchan): We don't actually execute this code since we leak NSS to |