summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 03:27:02 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-21 03:27:02 +0000
commit348ac8f5afdedbc33ddbf42ad19207c02b829951 (patch)
treec97ed451004af8ea4d7fc1d4fcf1b69776cbe4b7 /sql
parent641bee03b5c903a134a52476ded2be1699ead7aa (diff)
downloadchromium_src-348ac8f5afdedbc33ddbf42ad19207c02b829951.zip
chromium_src-348ac8f5afdedbc33ddbf42ad19207c02b829951.tar.gz
chromium_src-348ac8f5afdedbc33ddbf42ad19207c02b829951.tar.bz2
Record startup sizes for tagged SQLite databases.
BUG=240396 Review URL: https://chromiumcodereview.appspot.com/15499003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql')
-rw-r--r--sql/connection.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/connection.cc b/sql/connection.cc
index 701a129..b3af75e 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -7,6 +7,7 @@
#include <string.h>
#include "base/files/file_path.h"
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
@@ -129,6 +130,20 @@ Connection::~Connection() {
}
bool Connection::Open(const base::FilePath& path) {
+ if (!histogram_tag_.empty()) {
+ int64 size_64 = 0;
+ if (file_util::GetFileSize(path, &size_64)) {
+ size_t sample = static_cast<size_t>(size_64 / 1024);
+ std::string full_histogram_name = "Sqlite.SizeKB." + histogram_tag_;
+ base::HistogramBase* histogram =
+ base::Histogram::FactoryGet(
+ full_histogram_name, 1, 1000000, 50,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+ if (histogram)
+ histogram->Add(sample);
+ }
+ }
+
#if defined(OS_WIN)
return OpenInternal(WideToUTF8(path.value()));
#elif defined(OS_POSIX)