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(
for (int i = 0; i < kSimpleEntryFileCount; ++i)
out_entry_stat->data_size[i] = 0;
} else {
base::TimeDelta entry_age = base::Time::Now() - base::Time::UnixEpoch();
for (int i = 0; i < kSimpleEntryFileCount; ++i) {
PlatformFileInfo file_info;
bool success = GetPlatformFileInfo(files_[i], &file_info);
......@@ -534,16 +535,18 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles(
else
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;
SIMPLE_CACHE_UMA(CUSTOM_COUNTS,
"SyncOpenEntryAge", cache_type_,
entry_age.InHours(), 1, 1000, 50);
if (stream_age < entry_age)
entry_age = stream_age;
// Keep the file size in |data size_| briefly until the key is initialized
// properly.
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;
......
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