From 97ac07d0ffcca8e53812577472d62d76ae862d7b Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Fri, 20 Mar 2009 21:49:00 +0000 Subject: Disk cache: More instrumentation for the cache. Now we separate data between before and after the cache is full. Also, reduce the rate at which a particular client sends data to be only once a week. The effect is that the histogram data will only have one value per client, and the same client will not be "voting" on more than one version (release) at the same time. Review URL: http://codereview.chromium.org/50063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12218 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/eviction.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'net/disk_cache/eviction.cc') diff --git a/net/disk_cache/eviction.cc b/net/disk_cache/eviction.cc index 6f7df82..16d0957 100644 --- a/net/disk_cache/eviction.cc +++ b/net/disk_cache/eviction.cc @@ -140,11 +140,19 @@ void Eviction::ReportTrimTimes(EntryImpl* entry) { static bool first_time = true; if (first_time) { first_time = false; - 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()); + 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()); + } + + if (header_->create_time || !header_->lru.filled) { + // This is the first entry that we have to evict, generate some noise. + header_->lru.filled = 1; + backend_->FirstEviction(); + } } } -- cgit v1.1