summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 19:49:26 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 19:49:26 +0000
commit2bae73be8b3d156b6d34aa528b52494a7b93bfc9 (patch)
treec9e64e00fd17f5b01b1954c1513bd1c3331400e3 /net/disk_cache
parent6829650f3c4b5d987de765bb7c4fa8a0ec28789d (diff)
downloadchromium_src-2bae73be8b3d156b6d34aa528b52494a7b93bfc9.zip
chromium_src-2bae73be8b3d156b6d34aa528b52494a7b93bfc9.tar.gz
chromium_src-2bae73be8b3d156b6d34aa528b52494a7b93bfc9.tar.bz2
New hit rate by size histograms.
R=rvargas@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/10911040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_impl.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index b2527ec..05094a0 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1977,7 +1977,14 @@ void BackendImpl::ReportStats() {
int current_size = data_->header.num_bytes / (1024 * 1024);
int max_size = max_size_ / (1024 * 1024);
+ int hit_ratio_as_percentage = stats_.GetHitRatio();
+
CACHE_UMA(COUNTS_10000, "Size2", 0, current_size);
+ // For any bin in HitRatioBySize2, the hit ratio of caches of that size is the
+ // ratio of that bin's total count to the count in the same bin in the Size2
+ // histogram.
+ if (base::RandInt(0, 99) < hit_ratio_as_percentage)
+ CACHE_UMA(COUNTS_10000, "HitRatioBySize2", 0, current_size);
CACHE_UMA(COUNTS_10000, "MaxSize2", 0, max_size);
if (!max_size)
max_size++;
@@ -2013,6 +2020,11 @@ void BackendImpl::ReportStats() {
// that event, start reporting this:
CACHE_UMA(HOURS, "TotalTime", 0, static_cast<int>(total_hours));
+ // For any bin in HitRatioByTotalTime, the hit ratio of caches of that total
+ // time is the ratio of that bin's total count to the count in the same bin in
+ // the TotalTime histogram.
+ if (base::RandInt(0, 99) < hit_ratio_as_percentage)
+ CACHE_UMA(HOURS, "HitRatioByTotalTime", 0, implicit_cast<int>(total_hours));
int64 use_hours = stats_.GetCounter(Stats::LAST_REPORT_TIMER) / 120;
stats_.SetCounter(Stats::LAST_REPORT_TIMER, stats_.GetCounter(Stats::TIMER));
@@ -2026,16 +2038,12 @@ void BackendImpl::ReportStats() {
return;
CACHE_UMA(HOURS, "UseTime", 0, static_cast<int>(use_hours));
- int hit_ratio_as_percentage = stats_.GetHitRatio();
- CACHE_UMA(PERCENTAGE, "HitRatio", 0, hit_ratio_as_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_ratio_as_percentage)
- CACHE_UMA(HOURS, "HitRatioByTotalTime", 0, implicit_cast<int>(total_hours));
+ // For any bin in HitRatioByUseTime, the hit ratio of caches of that use time
+ // is the ratio of that bin's total count to the count in the same bin in the
+ // UseTime histogram.
if (base::RandInt(0, 99) < hit_ratio_as_percentage)
CACHE_UMA(HOURS, "HitRatioByUseTime", 0, implicit_cast<int>(use_hours));
+ CACHE_UMA(PERCENTAGE, "HitRatio", 0, hit_ratio_as_percentage);
int64 trim_rate = stats_.GetCounter(Stats::TRIM_ENTRY) / use_hours;
CACHE_UMA(COUNTS, "TrimRate", 0, static_cast<int>(trim_rate));