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

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: add quota database test Created 5 years, 2 months 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
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..6d6872f44259495f1953a63c6cdba6e53bcd5e30 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,18 @@ bool DeleteOriginInfoOnDBThread(const GURL& origin,
bool is_eviction,
QuotaDatabase* database) {
DCHECK(database);
+
+ QuotaDatabase::OriginInfoTableEntry entry;
+
+ base::Time now = base::Time::Now();
michaeln 2015/10/30 00:49:02 maybe swap lines |now| and |entry| are declared o
calamity 2015/11/02 06:27:44 Done.
+ if (database->GetOriginInfo(origin, type, &entry)) {
michaeln 2015/10/30 00:49:02 please add |is_eviction| to this condition too
calamity 2015/11/02 06:27:44 Done. Nice catch.
+ 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;
@@ -171,7 +187,6 @@ bool DeleteOriginInfoOnDBThread(const GURL& origin,
if (!database->GetOriginLastEvictionTime(origin, type, &last_eviction_time))
return false;
- base::Time now = base::Time::Now();
if (last_eviction_time != base::Time()) {
UMA_HISTOGRAM_LONG_TIMES(
QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram,

Powered by Google App Engine
This is Rietveld 408576698