diff options
author | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 06:47:23 +0000 |
---|---|---|
committer | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 06:47:23 +0000 |
commit | 75c2adb35f6e36c118fd52466cb92b9eacb6e88d (patch) | |
tree | df965cda9a7b6136c42a381757c01526fc5f0130 /net/disk_cache | |
parent | 8a6604243b387f25e9ffaa23df137c850f2379c4 (diff) | |
download | chromium_src-75c2adb35f6e36c118fd52466cb92b9eacb6e88d.zip chromium_src-75c2adb35f6e36c118fd52466cb92b9eacb6e88d.tar.gz chromium_src-75c2adb35f6e36c118fd52466cb92b9eacb6e88d.tar.bz2 |
Disk cache histograms tracking cache opens by size/age of cache.
These histograms compliment the other hit rate histograms I added in http://codereview.chromium.org/10911040/ , but instead of reporting by time interval, they report at each open. By comparing the Miss/Hit version of each histogram, you can get a rate in the same way that the stochastic interval-reporting version has.
This set of histograms will have different biasses than the time series data, as users who do a lot of operations will be represented more heavily.
As an added bonus, I'm also tracking the open time of cache misses, since that's shown up in http_cache_transaction as being interesting.
R=rvargas@chromium.org
BUG=None
Review URL: https://chromiumcodereview.appspot.com/10909126
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 05094a0..2de5952 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -686,14 +686,22 @@ EntryImpl* BackendImpl::OpenEntryImpl(const std::string& key) { bool error; EntryImpl* cache_entry = MatchEntry(key, hash, false, Addr(), &error); - if (!cache_entry) { - stats_.OnEvent(Stats::OPEN_MISS); - return NULL; - } - - if (ENTRY_NORMAL != cache_entry->entry()->Data()->state) { + if (cache_entry && ENTRY_NORMAL != cache_entry->entry()->Data()->state) { // The entry was already evicted. cache_entry->Release(); + cache_entry = NULL; + } + + int current_size = data_->header.num_bytes / (1024 * 1024); + int64 total_hours = stats_.GetCounter(Stats::TIMER) / 120; + int64 no_use_hours = stats_.GetCounter(Stats::LAST_REPORT_TIMER) / 120; + int64 use_hours = total_hours - no_use_hours; + + if (!cache_entry) { + CACHE_UMA(AGE_MS, "OpenTime.Miss", 0, start); + CACHE_UMA(COUNTS_10000, "AllOpenBySize.Miss", 0, current_size); + CACHE_UMA(HOURS, "AllOpenByTotalHours.Miss", 0, total_hours); + CACHE_UMA(HOURS, "AllOpenByUseHours.Miss", 0, use_hours); stats_.OnEvent(Stats::OPEN_MISS); return NULL; } @@ -704,6 +712,9 @@ EntryImpl* BackendImpl::OpenEntryImpl(const std::string& key) { Trace("Open hash 0x%x end: 0x%x", hash, cache_entry->entry()->address().value()); CACHE_UMA(AGE_MS, "OpenTime", 0, start); + CACHE_UMA(COUNTS_10000, "AllOpenBySize.Hit", 0, current_size); + CACHE_UMA(HOURS, "AllOpenByTotalHours.Hit", 0, total_hours); + CACHE_UMA(HOURS, "AllOpenByUseHours.Hit", 0, use_hours); stats_.OnEvent(Stats::OPEN_HIT); SIMPLE_STATS_COUNTER("disk_cache.hit"); return cache_entry; |