Commit 72928bb9 authored by rtenneti's avatar rtenneti Committed by Commit bot

QUIC - Collect performance stats for QUIC vs non-QUIC when google

properties are accessed.

R=rch@chromium.org, asvitkine@chromium.org
BUG=481618

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

Cr-Commit-Position: refs/heads/master@{#327335}
parent 255fd2c4
...@@ -1031,6 +1031,29 @@ bool IsLocalhostTLD(const std::string& host) { ...@@ -1031,6 +1031,29 @@ bool IsLocalhostTLD(const std::string& host) {
0; 0;
} }
bool HasGoogleHost(const GURL& url) {
static const char* kGoogleHostSuffixes[] = {
".google.com",
".youtube.com",
".gmail.com",
".doubleclick.net",
".gstatic.com",
".googlevideo.com",
".googleusercontent.com",
".googlesyndication.com",
".google-analytics.com",
".googleadservices.com",
".googleapis.com",
".ytimg.com",
};
const std::string& host = url.host();
for (const char* suffix : kGoogleHostSuffixes) {
if (EndsWith(host, suffix, false))
return true;
}
return false;
}
NetworkInterface::NetworkInterface() NetworkInterface::NetworkInterface()
: type(NetworkChangeNotifier::CONNECTION_UNKNOWN), prefix_length(0) { : type(NetworkChangeNotifier::CONNECTION_UNKNOWN), prefix_length(0) {
} }
......
...@@ -443,6 +443,10 @@ NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); ...@@ -443,6 +443,10 @@ NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host);
NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host); NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host);
// Returns true if the url's host is a Google server. This should only be used
// for histograms and shouldn't be used to affect behavior.
NET_EXPORT_PRIVATE bool HasGoogleHost(const GURL& url);
// A subset of IP address attributes which are actionable by the // A subset of IP address attributes which are actionable by the
// application layer. Currently unimplemented for all hosts; // application layer. Currently unimplemented for all hosts;
// IP_ADDRESS_ATTRIBUTE_NONE is always returned. // IP_ADDRESS_ATTRIBUTE_NONE is always returned.
......
...@@ -829,6 +829,43 @@ TEST(NetUtilTest, IsLocalhostTLD) { ...@@ -829,6 +829,43 @@ TEST(NetUtilTest, IsLocalhostTLD) {
EXPECT_FALSE(IsLocalhost("foo.localhoste")); EXPECT_FALSE(IsLocalhost("foo.localhoste"));
} }
TEST(NetUtilTest, GoogleHost) {
struct GoogleHostCase {
GURL url;
bool expected_output;
};
const GoogleHostCase google_host_cases[] = {
{GURL("http://.google.com"), true},
{GURL("http://.youtube.com"), true},
{GURL("http://.gmail.com"), true},
{GURL("http://.doubleclick.net"), true},
{GURL("http://.gstatic.com"), true},
{GURL("http://.googlevideo.com"), true},
{GURL("http://.googleusercontent.com"), true},
{GURL("http://.googlesyndication.com"), true},
{GURL("http://.google-analytics.com"), true},
{GURL("http://.googleadservices.com"), true},
{GURL("http://.googleapis.com"), true},
{GURL("http://a.google.com"), true},
{GURL("http://b.youtube.com"), true},
{GURL("http://c.gmail.com"), true},
{GURL("http://google.com"), false},
{GURL("http://youtube.com"), false},
{GURL("http://gmail.com"), false},
{GURL("http://google.coma"), false},
{GURL("http://agoogle.com"), false},
{GURL("http://oogle.com"), false},
{GURL("http://google.co"), false},
{GURL("http://oggole.com"), false},
};
for (size_t i = 0; i < arraysize(google_host_cases); ++i) {
EXPECT_EQ(google_host_cases[i].expected_output,
HasGoogleHost(google_host_cases[i].url));
}
}
// Verify GetNetworkList(). // Verify GetNetworkList().
TEST(NetUtilTest, GetNetworkList) { TEST(NetUtilTest, GetNetworkList) {
NetworkInterfaceList list; NetworkInterfaceList list;
......
...@@ -59,6 +59,11 @@ class NET_EXPORT HttpResponseInfo { ...@@ -59,6 +59,11 @@ class NET_EXPORT HttpResponseInfo {
bool skip_transient_headers, bool skip_transient_headers,
bool response_truncated) const; bool response_truncated) const;
// Whether QUIC is used or not.
bool DidUseQuic() const {
return connection_info == CONNECTION_INFO_QUIC1_SPDY3;
}
// The following is only defined if the request_time member is set. // The following is only defined if the request_time member is set.
// If this resource was found in the cache, then this bool is set, and // If this resource was found in the cache, then this bool is set, and
// request_time may corresponds to a time "far" in the past. Note that // request_time may corresponds to a time "far" in the past. Note that
......
...@@ -1452,10 +1452,37 @@ void URLRequestHttpJob::RecordPerfHistograms(CompletionCause reason) { ...@@ -1452,10 +1452,37 @@ void URLRequestHttpJob::RecordPerfHistograms(CompletionCause reason) {
} }
if (response_info_) { if (response_info_) {
bool is_google = request() && HasGoogleHost(request()->url());
bool used_quic = response_info_->DidUseQuic();
if (is_google) {
if (used_quic) {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpJob.TotalTime.Quic", total_time);
} else {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpJob.TotalTime.NotQuic", total_time);
}
}
if (response_info_->was_cached) { if (response_info_->was_cached) {
UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeCached", total_time); UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeCached", total_time);
if (is_google) {
if (used_quic) {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpJob.TotalTimeCached.Quic",
total_time);
} else {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpJob.TotalTimeCached.NotQuic",
total_time);
}
}
} else { } else {
UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeNotCached", total_time); UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeNotCached", total_time);
if (is_google) {
if (used_quic) {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpJob.TotalTimeNotCached.Quic",
total_time);
} else {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpJob.TotalTimeNotCached.NotQuic",
total_time);
}
}
} }
} }
......
...@@ -68786,6 +68786,16 @@ To add a new entry, add it with any value and run test to compute valid value. ...@@ -68786,6 +68786,16 @@ To add a new entry, add it with any value and run test to compute valid value.
<affected-histogram name="ThreadWatcher.UnresponsiveThreads"/> <affected-histogram name="ThreadWatcher.UnresponsiveThreads"/>
</histogram_suffixes> </histogram_suffixes>
<histogram_suffixes name="TotalTimeToGoogle" separator=".">
<suffix name="Quic"
label="Recorded for Google servers only when QUIC is used."/>
<suffix name="NotQuic"
label="Recorded for Google servers only when QUIC is not used."/>
<affected-histogram name="Net.HttpJob.TotalTime"/>
<affected-histogram name="Net.HttpJob.TotalTimeCached"/>
<affected-histogram name="Net.HttpJob.TotalTimeNotCached"/>
</histogram_suffixes>
<histogram_suffixes name="Tps65090Fets" separator="."> <histogram_suffixes name="Tps65090Fets" separator=".">
<suffix name="Fet1" label="FET1 on tps65090 (register 0xf)"/> <suffix name="Fet1" label="FET1 on tps65090 (register 0xf)"/>
<suffix name="Fet2" label="FET2 on tps65090 (register 0x10)"/> <suffix name="Fet2" label="FET2 on tps65090 (register 0x10)"/>
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