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

Unified Diff: net/http/http_cache_transaction.cc

Issue 2036123003: [HttpCache] Record age of validated and updated stale cache entries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS3 Created 4 years, 6 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 | « net/http/http_cache_transaction.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: net/http/http_cache_transaction.cc
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 1b3b9f4d8f71da2c56b9c1c0f5103a106048f0ce..04a0109f09db338af704b3c2d1151b13f3ee745e 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -2199,6 +2199,9 @@ ValidationType HttpCache::Transaction::RequiresValidation() {
} else {
validation_cause_ = VALIDATION_CAUSE_STALE;
stale_entry_freshness_ = lifetimes.freshness;
+ stale_entry_age_ = response_.headers->GetCurrentAge(
+ response_.request_time, response_.response_time,
+ cache_->clock_->Now());
}
}
@@ -2742,6 +2745,25 @@ void HttpCache::Transaction::RecordHistograms() {
UMA_HISTOGRAM_COUNTS("HttpCache.StaleEntry.FreshnessPeriodsSinceLastUsed",
freshness_periods_since_last_used);
+
+ if (validation_request) {
+ int64_t age_in_freshness_periods =
+ (stale_entry_age_ * 100) / stale_entry_freshness_;
+ if (transaction_pattern_ == PATTERN_ENTRY_VALIDATED) {
+ UMA_HISTOGRAM_COUNTS("HttpCache.StaleEntry.Validated.Age",
+ stale_entry_age_.InSeconds());
+ UMA_HISTOGRAM_COUNTS(
+ "HttpCache.StaleEntry.Validated.AgeInFreshnessPeriods",
+ age_in_freshness_periods);
+
+ } else {
+ UMA_HISTOGRAM_COUNTS("HttpCache.StaleEntry.Updated.Age",
+ stale_entry_age_.InSeconds());
+ UMA_HISTOGRAM_COUNTS(
+ "HttpCache.StaleEntry.Updated.AgeInFreshnessPeriods",
+ age_in_freshness_periods);
+ }
+ }
}
std::string mime_type;
@@ -2856,8 +2878,8 @@ void HttpCache::Transaction::RecordHistograms() {
}
}
- UMA_HISTOGRAM_ENUMERATION(
- "HttpCache.Pattern", transaction_pattern_, PATTERN_MAX);
+ UMA_HISTOGRAM_ENUMERATION("HttpCache.Pattern", transaction_pattern_,
+ PATTERN_MAX);
if (validation_request) {
UMA_HISTOGRAM_ENUMERATION("HttpCache.ValidationCause", validation_cause_,
« no previous file with comments | « net/http/http_cache_transaction.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698