diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-18 23:53:36 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-18 23:53:36 +0000 |
commit | b0358c7208c45f845673fe73c833129cd3314057 (patch) | |
tree | 8d721210e355e84b432d25dc2791ec83bb6c57e2 /net/disk_cache/stats.cc | |
parent | ab813125e93624da1cb95bfab5b55b5ccc0d9808 (diff) | |
download | chromium_src-b0358c7208c45f845673fe73c833129cd3314057.zip chromium_src-b0358c7208c45f845673fe73c833129cd3314057.tar.gz chromium_src-b0358c7208c45f845673fe73c833129cd3314057.tar.bz2 |
Disk cache: Instead of saving the cache stats only when
the destructor is called, store them each five minutes.
From the dev channel, 15% of the runs the disk cache destructor
is not called, so the stats are not that reliable without
this change.
Review URL: http://codereview.chromium.org/42373
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/stats.cc')
-rw-r--r-- | net/disk_cache/stats.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc index 6047c5c..46c41a0 100644 --- a/net/disk_cache/stats.cc +++ b/net/disk_cache/stats.cc @@ -135,17 +135,7 @@ bool Stats::Init(BackendImpl* backend, uint32* storage_addr) { } Stats::~Stats() { - if (!backend_) - return; - - OnDiskStats stats; - stats.signature = kDiskSignature; - stats.size = sizeof(stats); - memcpy(stats.data_sizes, data_sizes_, sizeof(data_sizes_)); - memcpy(stats.counters, counters_, sizeof(counters_)); - - Addr address(storage_addr_); - StoreStats(backend_, address, &stats); + Store(); } // The array will be filled this way: @@ -267,4 +257,18 @@ void Stats::GetItems(StatsItems* items) { } } +void Stats::Store() { + if (!backend_) + return; + + OnDiskStats stats; + stats.signature = kDiskSignature; + stats.size = sizeof(stats); + memcpy(stats.data_sizes, data_sizes_, sizeof(data_sizes_)); + memcpy(stats.counters, counters_, sizeof(counters_)); + + Addr address(storage_addr_); + StoreStats(backend_, address, &stats); +} + } // namespace disk_cache |