Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Unified Diff: storage/browser/quota/quota_manager.cc

Issue 1424653002: Add access count and time-since-accessed histograms to temp storage eviction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quota_uma
Patch Set: fix test Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « storage/browser/quota/quota_manager.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/quota/quota_manager.cc
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc
index 0052f2d7ebf4f12662042e91b66a74bec1a82179..c0f75609286173e1b2cffe9aeb62120fdbc95d28 100644
--- a/storage/browser/quota/quota_manager.cc
+++ b/storage/browser/quota/quota_manager.cc
@@ -76,6 +76,10 @@ const int QuotaManager::kEvictionIntervalInMilliSeconds =
const char QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram[] =
"Quota.TimeBetweenRepeatedOriginEvictions";
+const char QuotaManager::kEvictedOriginAccessedCountHistogram[] =
+ "Quota.EvictedOriginAccessCount";
+const char QuotaManager::kEvictedOriginTimeSinceAccessHistogram[] =
+ "Quota.EvictedOriginTimeSinceAccess";
// Heuristics: assuming average cloud server allows a few Gigs storage
// on the server side and the storage needs to be shared for user data
@@ -159,6 +163,19 @@ bool DeleteOriginInfoOnDBThread(const GURL& origin,
bool is_eviction,
QuotaDatabase* database) {
DCHECK(database);
+
+ base::Time now = base::Time::Now();
+
+ if (is_eviction) {
+ QuotaDatabase::OriginInfoTableEntry entry;
+ database->GetOriginInfo(origin, type, &entry);
+ UMA_HISTOGRAM_COUNTS(QuotaManager::kEvictedOriginAccessedCountHistogram,
+ entry.used_count);
+ UMA_HISTOGRAM_LONG_TIMES(
+ QuotaManager::kEvictedOriginTimeSinceAccessHistogram,
+ now - entry.last_access_time);
+ }
+
if (!database->DeleteOriginInfo(origin, type))
return false;
@@ -168,10 +185,8 @@ bool DeleteOriginInfoOnDBThread(const GURL& origin,
return database->DeleteOriginLastEvictionTime(origin, type);
base::Time last_eviction_time;
- if (!database->GetOriginLastEvictionTime(origin, type, &last_eviction_time))
- return false;
+ database->GetOriginLastEvictionTime(origin, type, &last_eviction_time);
- base::Time now = base::Time::Now();
if (last_eviction_time != base::Time()) {
UMA_HISTOGRAM_LONG_TIMES(
QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram,
« no previous file with comments | « storage/browser/quota/quota_manager.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698