summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 21:19:55 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 21:19:55 +0000
commit26d3857c6d85fc760ecf61276b5ffd6c61199a14 (patch)
tree51915c13c3e9c4c4ad748198f2f418658c039fc5 /net
parent4639f17fd36f6eb1dea14c81ff01d94bdca0e39f (diff)
downloadchromium_src-26d3857c6d85fc760ecf61276b5ffd6c61199a14.zip
chromium_src-26d3857c6d85fc760ecf61276b5ffd6c61199a14.tar.gz
chromium_src-26d3857c6d85fc760ecf61276b5ffd6c61199a14.tar.bz2
Add a new histogram macro to replace a few explicit calls.
There is no real change in functionality. Review URL: http://codereview.chromium.org/42514 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc27
-rw-r--r--net/disk_cache/eviction.cc9
2 files changed, 17 insertions, 19 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 9216d22..f106534 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -23,6 +23,10 @@
using base::Time;
using base::TimeDelta;
+// HISTOGRAM_HOURS will collect time related data with a granularity of hours
+// and normal values of a few months.
+#define UMA_HISTOGRAM_HOURS UMA_HISTOGRAM_COUNTS_10000
+
namespace {
const wchar_t* kIndexName = L"index";
@@ -700,15 +704,11 @@ void BackendImpl::FirstEviction() {
DCHECK(data_->header.create_time);
Time create_time = Time::FromInternalValue(data_->header.create_time);
- static Histogram counter("DiskCache.FillupAge", 1, 10000, 50);
- counter.SetFlags(kUmaTargetedHistogramFlag);
- counter.Add((Time::Now() - create_time).InHours());
-
+ UMA_HISTOGRAM_HOURS("DiskCache.FillupAge",
+ (Time::Now() - create_time).InHours());
+
int64 use_hours = stats_.GetCounter(Stats::TIMER) / 120;
- static Histogram counter2("DiskCache.FillupTime", 1, 10000, 50);
- counter2.SetFlags(kUmaTargetedHistogramFlag);
- counter2.Add(static_cast<int>(use_hours));
-
+ UMA_HISTOGRAM_HOURS("DiskCache.FillupTime", static_cast<int>(use_hours));
UMA_HISTOGRAM_PERCENTAGE("DiskCache.FirstHitRatio", stats_.GetHitRatio());
int avg_size = data_->header.num_bytes / GetEntryCount();
@@ -1306,18 +1306,13 @@ void BackendImpl::ReportStats() {
// that event, start reporting this:
int64 total_hours = stats_.GetCounter(Stats::TIMER) / 120;
- static Histogram counter("DiskCache.TotalTime", 1, 10000, 50);
- counter.SetFlags(kUmaTargetedHistogramFlag);
- counter.Add(static_cast<int>(total_hours));
-
+ UMA_HISTOGRAM_HOURS("DiskCache.TotalTime", static_cast<int>(total_hours));
+
int64 use_hours = stats_.GetCounter(Stats::LAST_REPORT_TIMER) / 120;
if (!use_hours || !GetEntryCount() || !data_->header.num_bytes)
return;
- static Histogram counter2("DiskCache.UseTime", 1, 10000, 50);
- counter2.SetFlags(kUmaTargetedHistogramFlag);
- counter2.Add(static_cast<int>(use_hours));
-
+ UMA_HISTOGRAM_HOURS("DiskCache.UseTime", static_cast<int>(use_hours));
UMA_HISTOGRAM_PERCENTAGE("DiskCache.HitRatio", stats_.GetHitRatio());
UMA_HISTOGRAM_PERCENTAGE("DiskCache.ResurrectRatio",
stats_.GetResurrectRatio());
diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc
index 16d0957..0075f5d 100644
--- a/net/disk_cache/eviction.cc
+++ b/net/disk_cache/eviction.cc
@@ -38,6 +38,10 @@
using base::Time;
+// HISTOGRAM_HOURS will collect time related data with a granularity of hours
+// and normal values of a few months.
+#define UMA_HISTOGRAM_HOURS UMA_HISTOGRAM_COUNTS_10000
+
namespace {
const int kCleanUpMargin = 1024 * 1024;
@@ -143,9 +147,8 @@ void Eviction::ReportTrimTimes(EntryImpl* entry) {
if (backend_->ShouldReportAgain()) {
std::string name(StringPrintf("DiskCache.TrimAge_%d",
header_->experiment));
- static Histogram counter(name.c_str(), 1, 10000, 50);
- counter.SetFlags(kUmaTargetedHistogramFlag);
- counter.Add((Time::Now() - entry->GetLastUsed()).InHours());
+ UMA_HISTOGRAM_HOURS(name.c_str(),
+ (Time::Now() - entry->GetLastUsed()).InHours());
}
if (header_->create_time || !header_->lru.filled) {