summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortzik <tzik@chromium.org>2016-01-28 19:05:09 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-29 03:06:45 +0000
commit0cb491d9240137e027cdb194620bf3978600d455 (patch)
treec8d14738622ca77aa17c7f88339d22452291e4ab
parent312184833715159edf1de0b7a267faea87fae379 (diff)
downloadchromium_src-0cb491d9240137e027cdb194620bf3978600d455.zip
chromium_src-0cb491d9240137e027cdb194620bf3978600d455.tar.gz
chromium_src-0cb491d9240137e027cdb194620bf3978600d455.tar.bz2
Add UMA historgam to measure response handling time of ResourceLoader
Add Net.ResourceLoader.ResponseStartToEnd family that measures the time elapsed from ResponseStarted to ResponseComplete. BUG=580928 Review URL: https://codereview.chromium.org/1627293002 Cr-Commit-Position: refs/heads/master@{#372271}
-rw-r--r--content/browser/loader/async_resource_handler.cc28
-rw-r--r--content/browser/loader/async_resource_handler.h3
-rw-r--r--tools/metrics/histograms/histograms.xml18
3 files changed, 49 insertions, 0 deletions
diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc
index e6b1ddf..f7ff190 100644
--- a/content/browser/loader/async_resource_handler.cc
+++ b/content/browser/loader/async_resource_handler.cc
@@ -207,6 +207,8 @@ bool AsyncResourceHandler::OnResponseStarted(ResourceResponse* response,
// request commits, avoiding the possibility of e.g. zooming the old content
// or of having to layout the new content twice.
+ response_started_ticks_ = base::TimeTicks::Now();
+
progress_timer_.Stop();
const ResourceRequestInfoImpl* info = GetRequestInfo();
if (!info->filter())
@@ -412,6 +414,8 @@ void AsyncResourceHandler::OnResponseCompleted(
request()->GetTotalReceivedBytes();
info->filter()->Send(
new ResourceMsg_RequestComplete(GetRequestID(), request_complete_data));
+
+ RecordHistogram();
}
bool AsyncResourceHandler::EnsureResourceBufferIsInitialized() {
@@ -457,4 +461,28 @@ int AsyncResourceHandler::CalculateEncodedDataLengthToReport() {
return encoded_data_length;
}
+void AsyncResourceHandler::RecordHistogram() {
+ int64_t elapsed_time =
+ (base::TimeTicks::Now() - response_started_ticks_).InMicroseconds();
+ int64_t encoded_length = request()->GetTotalReceivedBytes();
+ if (encoded_length < 2 * 1024) {
+ // The resource was smaller than the smallest required buffer size.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Net.ResourceLoader.ResponseStartToEnd.LT_2kB",
+ elapsed_time, 1, 100000, 100);
+ } else if (encoded_length < 32 * 1024) {
+ // The resource was smaller than single chunk.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Net.ResourceLoader.ResponseStartToEnd.LT_32kB",
+ elapsed_time, 1, 100000, 100);
+ } else if (encoded_length < 512 * 1024) {
+ // The resource was smaller than single chunk.
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Net.ResourceLoader.ResponseStartToEnd.LT_512kB",
+ elapsed_time, 1, 100000, 100);
+ } else {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Net.ResourceLoader.ResponseStartToEnd.Over_512kB",
+ elapsed_time, 1, 100000, 100);
+ }
+}
+
} // namespace content
diff --git a/content/browser/loader/async_resource_handler.h b/content/browser/loader/async_resource_handler.h
index ca06ed3..f46fef9 100644
--- a/content/browser/loader/async_resource_handler.h
+++ b/content/browser/loader/async_resource_handler.h
@@ -67,6 +67,7 @@ class AsyncResourceHandler : public ResourceHandler,
void OnDefer();
bool CheckForSufficientResource();
int CalculateEncodedDataLengthToReport();
+ void RecordHistogram();
scoped_refptr<ResourceBuffer> buffer_;
ResourceDispatcherHostImpl* rdh_;
@@ -83,6 +84,8 @@ class AsyncResourceHandler : public ResourceHandler,
bool sent_received_response_msg_;
bool sent_first_data_msg_;
+ base::TimeTicks response_started_ticks_;
+
uint64_t last_upload_position_;
bool waiting_for_upload_progress_ack_;
base::TimeTicks last_upload_ticks_;
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index a8f848e..bc68c7b 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -26663,6 +26663,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
+<histogram name="Net.ResourceLoader.ResponseStartToEnd" units="microseconds">
+ <owner>tzik@chromium.org</owner>
+ <summary>
+ Time from the start to the end of receiving a response body. Recorded for
+ each resource load.
+ </summary>
+</histogram>
+
<histogram name="Net.ResponseSizeByProcess.Browser" units="KB">
<owner>ttuttle@chromium.org</owner>
<summary>
@@ -86103,6 +86111,16 @@ To add a new entry, add it with any value and run test to compute valid value.
<affected-histogram name="Media.EME.RequestMediaKeySystemAccess"/>
</histogram_suffixes>
+<histogram_suffixes name="ResourceLoaderSizeSlice" separator=".">
+ <suffix name="LT_2kB" label="Sliced for resources smaller than 2kB."/>
+ <suffix name="LT_32kB"
+ label="Sliced for resources smaller than 32kB and larger than 2kB."/>
+ <suffix name="LT_512kB"
+ label="Sliced for resources smaller than 512kB and larger than 32kB."/>
+ <suffix name="Over_512kB" label="Sliced for resources larger than 512kB."/>
+ <affected-histogram name="Net.ResourceLoader.ResponseStartToEnd"/>
+</histogram_suffixes>
+
<histogram_suffixes name="ResourcePrefetchPredictorNetworkTypePrefetch"
separator=".">
<suffix name="NotPrefetched"