summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-24 16:39:39 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-24 16:39:39 +0000
commit658f9ca69a0c2187948618b55a9453068052838d (patch)
tree42320ff686903c26d581e3156b8ee0753a53f8fb /net/disk_cache
parente387f29e37fb64726428a20593df7fb5ebda4bdf (diff)
downloadchromium_src-658f9ca69a0c2187948618b55a9453068052838d.zip
chromium_src-658f9ca69a0c2187948618b55a9453068052838d.tar.gz
chromium_src-658f9ca69a0c2187948618b55a9453068052838d.tar.bz2
New histograms to track disk cache hit rate by age and use time.
Previously we reported the age of the disk cache, and we reported the hit rate of the disk cache, but there was no statistic that let us correlate the two. These histograms let us see how the hit rate in a cache varies with its age; perhaps we'll learn that there's an equilibrium hit rate, or perhaps we'll learn how long it takes to reach that. R=rvargas@chromium.org,tburkard@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/10834361 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_impl.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 1fd92a1..71d4168 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -2026,7 +2026,16 @@ void BackendImpl::ReportStats() {
return;
CACHE_UMA(HOURS, "UseTime", 0, static_cast<int>(use_hours));
- CACHE_UMA(PERCENTAGE, "HitRatio", 0, stats_.GetHitRatio());
+ const int hit_percentage = stats_.GetHitRatio();
+ CACHE_UMA(PERCENTAGE, "HitRatio", 0, hit_percentage);
+
+ // For any bin in HitRatioByTotalTime, the HitRatio of caches of that age is
+ // approximately the value of HitRatioByTotalTime / TotalTime. Likewise for
+ // HitRatioByUseTime.
+ if (base::RandInt(0, 99) < hit_percentage)
+ CACHE_UMA(HOURS, "HitRatioByTotalTime", 0, implicit_cast<int>(total_hours));
+ if (base::RandInt(0, 99) < hit_percentage)
+ CACHE_UMA(HOURS, "HitRatioByUseTime", 0, implicit_cast<int>(use_hours));
int64 trim_rate = stats_.GetCounter(Stats::TRIM_ENTRY) / use_hours;
CACHE_UMA(COUNTS, "TrimRate", 0, static_cast<int>(trim_rate));