diff options
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 0a09148..9ffb97e 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -30,6 +30,7 @@ #include "net/disk_cache/backend_impl.h" #include "base/file_util.h" +#include "base/histogram.h" #include "base/message_loop.h" #include "base/scoped_handle.h" #include "base/string_util.h" @@ -325,6 +326,7 @@ bool BackendImpl::OpenEntry(const std::string& key, Entry** entry) { if (disabled_) return false; + Time start = Time::Now(); uint32 hash = Hash(key); EntryImpl* cache_entry = MatchEntry(key, hash, false); @@ -336,6 +338,7 @@ bool BackendImpl::OpenEntry(const std::string& key, Entry** entry) { DCHECK(entry); *entry = cache_entry; + UMA_HISTOGRAM_TIMES(L"DiskCache.OpenTime", Time::Now() - start); stats_.OnEvent(Stats::OPEN_HIT); return true; } @@ -344,6 +347,7 @@ bool BackendImpl::CreateEntry(const std::string& key, Entry** entry) { if (disabled_ || key.empty()) return false; + Time start = Time::Now(); uint32 hash = Hash(key); scoped_refptr<EntryImpl> parent; @@ -406,6 +410,7 @@ bool BackendImpl::CreateEntry(const std::string& key, Entry** entry) { *entry = NULL; cache_entry.swap(reinterpret_cast<EntryImpl**>(entry)); + UMA_HISTOGRAM_TIMES(L"DiskCache.CreateTime", Time::Now() - start); stats_.OnEvent(Stats::CREATE_HIT); Trace("create entry hit "); return true; @@ -1034,6 +1039,7 @@ void BackendImpl::TrimCache(bool empty) { if (disabled_) return; + Time start = Time::Now(); Rankings::ScopedRankingsBlock node(&rankings_); Rankings::ScopedRankingsBlock next(&rankings_, rankings_.GetPrev(node.get())); DCHECK(next.get()); @@ -1053,6 +1059,9 @@ void BackendImpl::TrimCache(bool empty) { if (node->Data()->pointer) { entry = EntryImpl::Update(entry); } + static Histogram counter(L"DiskCache.TrimAge", 1, 10000, 50); + counter.SetFlags(kUmaTargetedHistogramFlag); + counter.Add((Time::Now() - entry->GetLastUsed()).InHours()); entry->Doom(); entry->Release(); if (!empty) @@ -1060,6 +1069,7 @@ void BackendImpl::TrimCache(bool empty) { } } + UMA_HISTOGRAM_TIMES(L"DiskCache.TotalTrimTime", Time::Now() - start); Trace("*** Trim Cache end ***"); return; } |