| 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);
|
| }
|
|
|
| } // namespace
|
|
|