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

Unified Diff: components/precache/core/precache_fetcher.cc

Issue 2736323002: Add Precache.Fetch.ResponseBytes.Daily.
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | components/precache/core/proto/quota.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/precache/core/precache_fetcher.cc
diff --git a/components/precache/core/precache_fetcher.cc b/components/precache/core/precache_fetcher.cc
index bab9bc580b1bc06ae111b212dc253cf0e62cdcf1..c6ee3914e2577b903da0777166d103e644061cb6 100644
--- a/components/precache/core/precache_fetcher.cc
+++ b/components/precache/core/precache_fetcher.cc
@@ -720,6 +720,16 @@ void PrecacheFetcher::OnQuotaInfoRetrieved(const PrecacheQuota& quota) {
if (IsQuotaTimeExpired(quota_, time_now)) {
// This is a new day. Update daily quota, that starts today and expires by
// end of today.
+
+ // If a previous day existed, report its usage.
+ if (quota_.has_start_time()) {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Precache.Fetch.ResponseBytes.Daily",
+ unfinished_work_->config_settings().daily_quota_total() -
+ quota_.remaining(),
+ 1, kMaxResponseBytes, 100);
+ }
+
quota_.set_start_time(time_now.LocalMidnight().ToInternalValue());
quota_.set_remaining(
unfinished_work_->config_settings().daily_quota_total());
« no previous file with comments | « no previous file | components/precache/core/proto/quota.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698