summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-23 17:17:48 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-23 17:17:48 +0000
commitc69ad76018d996ef0b3680bff53ebf18beff33d9 (patch)
tree180faab8362423d9b0a2254a1f5dcc5e64236e61 /chrome/browser/history
parent5c5de8c2e01750b642250c678d1cea09b057d051 (diff)
downloadchromium_src-c69ad76018d996ef0b3680bff53ebf18beff33d9.zip
chromium_src-c69ad76018d996ef0b3680bff53ebf18beff33d9.tar.gz
chromium_src-c69ad76018d996ef0b3680bff53ebf18beff33d9.tar.bz2
Add some new histograms for history, and UMA-enable a few others.
BUG=19773 TEST=none Review URL: http://codereview.chromium.org/212014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26939 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/history_backend.cc12
-rw-r--r--chrome/browser/history/history_database.cc29
-rw-r--r--chrome/browser/history/text_database_manager.cc4
3 files changed, 36 insertions, 9 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index eddf2d0..339d584 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1041,8 +1041,8 @@ void HistoryBackend::QueryHistory(scoped_refptr<QueryHistoryRequest> request,
request->ForwardResult(QueryHistoryRequest::TupleType(request->handle(),
&request->value));
- HISTOGRAM_TIMES("History.QueryHistory",
- TimeTicks::Now() - beginning_time);
+ UMA_HISTOGRAM_TIMES("History.QueryHistory",
+ TimeTicks::Now() - beginning_time);
}
// Basic time-based querying of history.
@@ -1359,8 +1359,8 @@ void HistoryBackend::GetPageThumbnailDirectly(
if (!success)
*data = NULL; // This will tell the callback there was an error.
- HISTOGRAM_TIMES("History.GetPageThumbnail",
- TimeTicks::Now() - beginning_time);
+ UMA_HISTOGRAM_TIMES("History.GetPageThumbnail",
+ TimeTicks::Now() - beginning_time);
}
}
@@ -1542,8 +1542,8 @@ void HistoryBackend::GetFavIconForURL(
TimeDelta::FromDays(kFavIconRefetchDays);
}
- HISTOGRAM_TIMES("History.GetFavIconForURL",
- TimeTicks::Now() - beginning_time);
+ UMA_HISTOGRAM_TIMES("History.GetFavIconForURL",
+ TimeTicks::Now() - beginning_time);
}
request->ForwardResult(
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc
index 198c6a4..c4825ff 100644
--- a/chrome/browser/history/history_database.cc
+++ b/chrome/browser/history/history_database.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,9 @@
#include <algorithm>
#include <set>
+#include "base/file_util.h"
+#include "base/histogram.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
#include "chrome/common/sqlite_utils.h"
@@ -23,6 +26,29 @@ static const int kCurrentVersionNumber = 17;
static const int kCompatibleVersionNumber = 16;
static const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold";
+void ComputeDatabaseMetrics(const FilePath& history_name, sqlite3* db) {
+ if (base::RandInt(1, 100) != 50)
+ return; // Only do this computation sometimes since it can be expensive.
+
+ int64 file_size = 0;
+ if (!file_util::GetFileSize(history_name, &file_size))
+ return;
+ int file_mb = static_cast<int>(file_size / (1024 * 1024));
+ UMA_HISTOGRAM_MEMORY_MB("History.DatabaseFileMB", file_mb);
+
+ SQLStatement url_count;
+ if (url_count.prepare(db, "SELECT count(*) FROM urls") != SQLITE_OK ||
+ url_count.step() != SQLITE_ROW)
+ return;
+ UMA_HISTOGRAM_COUNTS("History.URLTableCount", url_count.column_int(0));
+
+ SQLStatement visit_count;
+ if (visit_count.prepare(db, "SELECT count(*) FROM visits") != SQLITE_OK ||
+ visit_count.step() != SQLITE_ROW)
+ return;
+ UMA_HISTOGRAM_COUNTS("History.VisitTableCount", visit_count.column_int(0));
+}
+
} // namespace
HistoryDatabase::HistoryDatabase()
@@ -87,6 +113,7 @@ InitStatus HistoryDatabase::Init(const FilePath& history_name,
// Succeeded: keep the DB open by detaching the auto-closer.
scoper.Detach();
db_closer_.Attach(&db_, &statement_cache_);
+ ComputeDatabaseMetrics(history_name, db_);
return INIT_OK;
}
diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc
index 66580c3..03e992f 100644
--- a/chrome/browser/history/text_database_manager.cc
+++ b/chrome/browser/history/text_database_manager.cc
@@ -310,8 +310,8 @@ bool TextDatabaseManager::AddPageData(const GURL& url,
ConvertStringForIndexer(title),
ConvertStringForIndexer(body));
- HISTOGRAM_TIMES("History.AddFTSData",
- TimeTicks::Now() - beginning_time);
+ UMA_HISTOGRAM_TIMES("History.AddFTSData",
+ TimeTicks::Now() - beginning_time);
if (history_publisher_)
history_publisher_->PublishPageContent(visit_time, url, title, body);