From 1fdcb685a3dc07c8f352176a60ab14750329d08d Mon Sep 17 00:00:00 2001 From: "mattm@chromium.org" Date: Fri, 28 Dec 2012 23:58:57 +0000 Subject: [PATCH] Add histograms for SQLiteServerBoundCertStore loading. BUG=89665 Review URL: https://chromiumcodereview.appspot.com/11640057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174749 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/net/sqlite_server_bound_cert_store.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/chrome/browser/net/sqlite_server_bound_cert_store.cc b/chrome/browser/net/sqlite_server_bound_cert_store.cc index 75f931851156..fb6ab57c3d61 100644 --- a/chrome/browser/net/sqlite_server_bound_cert_store.cc +++ b/chrome/browser/net/sqlite_server_bound_cert_store.cc @@ -13,6 +13,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" @@ -164,12 +165,18 @@ bool SQLiteServerBoundCertStore::Backend::Load( // moved to the DB thread as part of http://crbug.com/89665. base::ThreadRestrictions::ScopedAllowIO allow_io; + base::TimeTicks start = base::TimeTicks::Now(); + // Ensure the parent directory for storing certs is created before reading // from it. const FilePath dir = path_.DirName(); if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) return false; + int64 db_size = 0; + if (file_util::GetFileSize(path_, &db_size)) + UMA_HISTOGRAM_COUNTS("DomainBoundCerts.DBSizeInKB", db_size / 1024 ); + db_.reset(new sql::Connection); if (!db_->Open(path_)) { NOTREACHED() << "Unable to open cert DB."; @@ -210,6 +217,12 @@ bool SQLiteServerBoundCertStore::Backend::Load( certs->push_back(cert.release()); } + UMA_HISTOGRAM_COUNTS_10000("DomainBoundCerts.DBLoadedCount", certs->size()); + UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.DBLoadTime", + base::TimeTicks::Now() - start, + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromMinutes(1), + 50); return true; } -- 2.11.4.GIT