summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 17:31:35 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 17:31:35 +0000
commit80bdee7b36af8131d5c10db1462ba925c4d212ee (patch)
treec512044ac1a2641aaa74e90abd66c909810d03fe /net
parentddbab02846a8ffda0b54d7c5c877383869b6261e (diff)
downloadchromium_src-80bdee7b36af8131d5c10db1462ba925c4d212ee.zip
chromium_src-80bdee7b36af8131d5c10db1462ba925c4d212ee.tar.gz
chromium_src-80bdee7b36af8131d5c10db1462ba925c4d212ee.tar.bz2
Disk cache: fix broken UMA reports.
Review URL: http://codereview.chromium.org/62176 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc8
-rw-r--r--net/disk_cache/entry_impl.cc3
-rw-r--r--net/disk_cache/stats.h2
3 files changed, 11 insertions, 2 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 3a0a336..4984ecf 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1310,6 +1310,13 @@ void BackendImpl::ReportStats() {
CACHE_UMA(HOURS, "TotalTime", 0, static_cast<int>(total_hours));
int64 use_hours = stats_.GetCounter(Stats::LAST_REPORT_TIMER) / 120;
+ stats_.SetCounter(Stats::LAST_REPORT_TIMER, stats_.GetCounter(Stats::TIMER));
+
+ // We may see users with no use_hours at this point if this is the first time
+ // we are running this code.
+ if (use_hours)
+ use_hours = total_hours - use_hours;
+
if (!use_hours || !GetEntryCount() || !data_->header.num_bytes)
return;
@@ -1329,7 +1336,6 @@ void BackendImpl::ReportStats() {
stats_.ResetRatios();
stats_.SetCounter(Stats::TRIM_ENTRY, 0);
- stats_.SetCounter(Stats::LAST_REPORT_TIMER, 0);
}
void BackendImpl::UpgradeTo2_1() {
diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc
index 8ff7b21..a000785 100644
--- a/net/disk_cache/entry_impl.cc
+++ b/net/disk_cache/entry_impl.cc
@@ -539,6 +539,9 @@ EntryImpl* EntryImpl::Update(EntryImpl* entry) {
bool EntryImpl::IsDirty(int32 current_id) {
DCHECK(node_.HasData());
+ // We are checking if the entry is valid or not. If there is a pointer here,
+ // |dirty| has to be the id of the cache that is using the entry (the one
+ // that created the pointer), 0 is not a valid id.
if (node_.Data()->pointer && !node_.Data()->dirty)
return true;
diff --git a/net/disk_cache/stats.h b/net/disk_cache/stats.h
index 32585d4..1dcd39f 100644
--- a/net/disk_cache/stats.h
+++ b/net/disk_cache/stats.h
@@ -43,7 +43,7 @@ class Stats {
GET_RANKINGS, // We got the ranking info without reading the whole entry.
FATAL_ERROR,
LAST_REPORT, // Time of the last time we sent a report.
- LAST_REPORT_TIMER, // Timer count since last report.
+ LAST_REPORT_TIMER, // Timer count of the last time we sent a report.
MAX_COUNTER
};