Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1916)

Unified Diff: chrome/browser/history/history_database.cc

Issue 12047042: Add history-view-related UMA metrics and histograms for locally managed users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_database.cc
===================================================================
--- chrome/browser/history/history_database.cc (revision 177135)
+++ chrome/browser/history/history_database.cc (working copy)
@@ -13,6 +13,7 @@
#include "base/metrics/histogram.h"
#include "base/rand_util.h"
#include "base/string_util.h"
+#include "base/time.h"
#include "sql/transaction.h"
#if defined(OS_MACOSX)
@@ -39,6 +40,7 @@
if (base::RandInt(1, 100) != 50)
return; // Only do this computation sometimes since it can be expensive.
+ base::TimeTicks start_time = base::TimeTicks::Now();
int64 file_size = 0;
if (!file_util::GetFileSize(history_name, &file_size))
return;
@@ -55,6 +57,23 @@
if (!visit_count.Step())
return;
UMA_HISTOGRAM_COUNTS("History.VisitTableCount", visit_count.ColumnInt(0));
+
+ base::Time one_week_ago = base::Time::Now() - base::TimeDelta::FromDays(7);
+ sql::Statement weekly_visit_count(db.GetUniqueStatement(
+ "SELECT count(*) FROM visits WHERE visit_time > ?"));
+ weekly_visit_count.BindInt64(0, one_week_ago.ToInternalValue());
+ UMA_HISTOGRAM_COUNTS("History.WeeklyVisitCount",
+ weekly_visit_count.ColumnInt(0));
+
+ base::Time one_month_ago = base::Time::Now() - base::TimeDelta::FromDays(30);
+ sql::Statement monthly_visit_count(db.GetUniqueStatement(
+ "SELECT count(*) FROM visits WHERE visit_time > ?"));
+ monthly_visit_count.BindInt64(0, one_month_ago.ToInternalValue());
+ UMA_HISTOGRAM_COUNTS("History.MonthlyVisitCount",
+ monthly_visit_count.ColumnInt(0));
+
+ UMA_HISTOGRAM_TIMES("History.DatabaseBasicMetricsTime",
+ base::TimeTicks::Now() - start_time);
Scott Hess - ex-Googler 2013/01/23 22:15:37 Overall looks good. Just a couple questions. Fir
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698