Commit ed4cc4c4 authored by bnc's avatar bnc Committed by Commit bot

Measure browser->render->browser hop time in UMA.

Measure AsyncResourceHandler browser->render->browser hop time in UMA to
understand the potential performance benefits of handling redirects entiely in
the browser process instead.

BUG=395552

Review URL: https://codereview.chromium.org/555913002

Cr-Commit-Position: refs/heads/master@{#294165}
parent 569c527d
......@@ -14,6 +14,7 @@
#include "base/memory/shared_memory.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "content/browser/devtools/devtools_netlog_observer.h"
#include "content/browser/host_zoom_map_impl.h"
#include "content/browser/loader/resource_buffer.h"
......@@ -113,6 +114,13 @@ void AsyncResourceHandler::OnFollowRedirect(int request_id) {
return;
}
if (!redirect_start_time_.is_null()) {
UMA_HISTOGRAM_TIMES("Net.AsyncResourceHandler_RedirectHopTime",
TimeTicks::Now() - redirect_start_time_);
// Reset start time.
redirect_start_time_ = TimeTicks();
}
ResumeIfDeferred();
}
......@@ -143,6 +151,8 @@ bool AsyncResourceHandler::OnRequestRedirected(
if (!info->filter())
return false;
redirect_start_time_ = TimeTicks::Now();
*defer = did_defer_ = true;
OnDefer();
......
......@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "content/browser/loader/resource_handler.h"
#include "content/browser/loader/resource_message_delegate.h"
#include "url/gurl.h"
......@@ -78,6 +79,8 @@ class AsyncResourceHandler : public ResourceHandler,
int64_t reported_transfer_size_;
base::TimeTicks redirect_start_time_;
DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler);
};
......
......@@ -14102,6 +14102,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="Net.AsyncResourceHandler_RedirectHopTime" units="milliseconds">
<owner>bnc@chromium.org</owner>
<summary>
The time between the call of AsyncResourceHandler::OnRequestRedirected and
the FollowRedirect IPC message from ResourceHost, that is, the length of the
redirect browser-renderer-browser hop.
</summary>
</histogram>
<histogram name="Net.AsyncResourceHandler_SharedIOBuffer_Alloc" units="bytes">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>The size of a SharedIOBuffer allocation.</summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment