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

Unified Diff: net/http/http_cache_transaction.cc

Issue 1888043002: Differentiate between small and large images in caching metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | 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 178df98d6e1a1876fc748eb89d4bb43202fb284a..933d01c85c58470179f5cdbdd566427743fa323b 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -2706,8 +2706,8 @@ void HttpCache::Transaction::RecordHistograms() {
}
std::string mime_type;
- if (GetResponseInfo()->headers &&
- GetResponseInfo()->headers->GetMimeType(&mime_type)) {
+ HttpResponseHeaders* response_headers = GetResponseInfo()->headers.get();
+ if (response_headers && response_headers->GetMimeType(&mime_type)) {
// Record the cache pattern by resource type. The type is inferred by
// response header mime type, which could be incorrect, so this is just an
// estimate.
@@ -2723,6 +2723,13 @@ void HttpCache::Transaction::RecordHistograms() {
transaction_pattern_, PATTERN_MAX);
} else if (base::StartsWith(mime_type, "image/",
base::CompareCase::SENSITIVE)) {
+ if (response_headers->GetContentLength() < 100) {
Deprecated (see juliatuttle) 2016/04/14 14:11:33 GetContentLength returns -1 if there is no Content
jkarlin 2016/04/14 14:28:52 Good point, better to skip them. Done.
+ UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.TinyImage"),
+ transaction_pattern_, PATTERN_MAX);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.NonTinyImage"),
+ transaction_pattern_, PATTERN_MAX);
+ }
UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.Image"),
transaction_pattern_, PATTERN_MAX);
} else if (base::EndsWith(mime_type, "javascript",
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698