Commit 5a876138 authored by pasko@chromium.org's avatar pasko@chromium.org

Simple Cache: report age by (stream -> entry)

We have a histogram reporting 'entry age on Open of an existing entry' by
looking at individual files on the filesystem. Change to report once for each
entry.

BUG=none

Review URL: https://chromiumcodereview.appspot.com/23717040

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222166 0039d316-1c4b-4281-b951-d872f2087c98
parent be047420
...@@ -520,6 +520,7 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles( ...@@ -520,6 +520,7 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles(
for (int i = 0; i < kSimpleEntryFileCount; ++i) for (int i = 0; i < kSimpleEntryFileCount; ++i)
out_entry_stat->data_size[i] = 0; out_entry_stat->data_size[i] = 0;
} else { } else {
base::TimeDelta entry_age = base::Time::Now() - base::Time::UnixEpoch();
for (int i = 0; i < kSimpleEntryFileCount; ++i) { for (int i = 0; i < kSimpleEntryFileCount; ++i) {
PlatformFileInfo file_info; PlatformFileInfo file_info;
bool success = GetPlatformFileInfo(files_[i], &file_info); bool success = GetPlatformFileInfo(files_[i], &file_info);
...@@ -534,16 +535,18 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles( ...@@ -534,16 +535,18 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles(
else else
out_entry_stat->last_modified = file_info.last_modified; out_entry_stat->last_modified = file_info.last_modified;
base::TimeDelta entry_age = base::TimeDelta stream_age =
base::Time::Now() - out_entry_stat->last_modified; base::Time::Now() - out_entry_stat->last_modified;
SIMPLE_CACHE_UMA(CUSTOM_COUNTS, if (stream_age < entry_age)
"SyncOpenEntryAge", cache_type_, entry_age = stream_age;
entry_age.InHours(), 1, 1000, 50);
// Keep the file size in |data size_| briefly until the key is initialized // Keep the file size in |data size_| briefly until the key is initialized
// properly. // properly.
out_entry_stat->data_size[i] = file_info.size; out_entry_stat->data_size[i] = file_info.size;
} }
SIMPLE_CACHE_UMA(CUSTOM_COUNTS,
"SyncOpenEntryAge", cache_type_,
entry_age.InHours(), 1, 1000, 50);
} }
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment