diff options
author | bengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-19 00:54:28 +0000 |
---|---|---|
committer | bengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-19 00:54:28 +0000 |
commit | 37182bf1f86ad9901da4b533a20da11ba6b24777 (patch) | |
tree | 8fb62d297814d09670a05d6dc03cf005d3aa0f2b | |
parent | fecb5fede101af9c6425c7c0d07edb16f3e8642f (diff) | |
download | chromium_src-37182bf1f86ad9901da4b533a20da11ba6b24777.zip chromium_src-37182bf1f86ad9901da4b533a20da11ba6b24777.tar.gz chromium_src-37182bf1f86ad9901da4b533a20da11ba6b24777.tar.bz2 |
Added UMA to track bytes for cacheable resources
This includes a count of received bytes with associated freshness
lifetimes that are greater than 0, 4, and 24 hours, as well as
counts of resource retrievals by freshness lifetime.
BUG=249035
Review URL: https://chromiumcodereview.appspot.com/16838005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207132 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/net/chrome_network_delegate.cc | 26 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 28 |
2 files changed, 52 insertions, 2 deletions
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index fad14af..b43b53b 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -327,7 +327,8 @@ void StoreAccumulatedContentLength(int received_content_length, } void RecordContentLengthHistograms( - int64 received_content_length, int64 original_content_length) { + int64 received_content_length, int64 original_content_length, + const base::TimeDelta& freshness_lifetime) { #if defined(OS_ANDROID) // Add the current resource to these histograms only when a valid // X-Original-Content-Length header is present. @@ -348,6 +349,23 @@ void RecordContentLengthHistograms( original_content_length); UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifference", original_content_length - received_content_length); + UMA_HISTOGRAM_CUSTOM_TIMES("Net.HttpContentFreshnessLifetime", + freshness_lifetime, + base::TimeDelta::FromHours(1), + base::TimeDelta::FromDays(30), 100); + if (freshness_lifetime.InSeconds() <= 0) + return; + UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable", + received_content_length); + if (freshness_lifetime.InHours() < 4) + return; + UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable4Hours", + received_content_length); + + if (freshness_lifetime.InHours() < 24) + return; + UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable24Hours", + received_content_length); #endif } @@ -566,10 +584,14 @@ void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, int64 adjusted_original_content_length = original_content_length; if (adjusted_original_content_length == -1) adjusted_original_content_length = received_content_length; + base::TimeDelta freshness_lifetime = + request->response_info().headers->GetFreshnessLifetime( + request->response_info().response_time); AccumulateContentLength(received_content_length, adjusted_original_content_length); RecordContentLengthHistograms(received_content_length, - original_content_length); + original_content_length, + freshness_lifetime); DVLOG(2) << __FUNCTION__ << " received content length: " << received_content_length << " original content length: " << original_content_length diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index b3b3e89..c36793f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -4902,6 +4902,10 @@ other types of suffix sets. </summary> </histogram> +<histogram name="Net.HttpContentFreshnessLifetime" units="milliseconds"> + <summary>Length of time that a received resource will be cacheable.</summary> +</histogram> + <histogram name="Net.HttpContentLength" units="bytes"> <summary> Size of the response body. This is the actual number of bytes received, @@ -4910,6 +4914,30 @@ other types of suffix sets. </summary> </histogram> +<histogram name="Net.HttpContentLengthCacheable" units="bytes"> + <summary> + Size of the response body if it is cacheable. This is the actual number of + bytes received, which usually agrees with but is not necessarily the same as + the size specified by the Content-Length header. + </summary> +</histogram> + +<histogram name="Net.HttpContentLengthCacheable24Hours" units="bytes"> + <summary> + Size of the response body if it is cacheable for at least 24 hours. This is + the actual number of bytes received, which usually agrees with but is not + necessarily the same as the size specified by the Content-Length header. + </summary> +</histogram> + +<histogram name="Net.HttpContentLengthCacheable4Hours" units="bytes"> + <summary> + Size of the response body if it is cacheable for at least 4 hours. This is + the actual number of bytes received, which usually agrees with but is not + necessarily the same as the size specified by the Content-Length header. + </summary> +</histogram> + <histogram name="Net.HttpContentLengthDifference" units="bytes"> <summary> The difference between the size specified in the X-Original-Content-Length |