summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 03:20:33 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 03:20:33 +0000
commit7df03645f82d851ecf94a185bd4415fadb4af705 (patch)
treeb98b309bdc863148f942e16711d8d9f93889979e /net
parent575b3ff6a705a6eac675138d7c72ccd6dbcf5c09 (diff)
downloadchromium_src-7df03645f82d851ecf94a185bd4415fadb4af705.zip
chromium_src-7df03645f82d851ecf94a185bd4415fadb4af705.tar.gz
chromium_src-7df03645f82d851ecf94a185bd4415fadb4af705.tar.bz2
Track the RTT via histograms for PING messages sent from client.
BUG=100651 R=jar,willchan TEST=network unittests Review URL: http://codereview.chromium.org/8333008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/spdy/spdy_session.cc13
-rw-r--r--net/spdy/spdy_session.h5
2 files changed, 18 insertions, 0 deletions
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 62db0f7..bc8a100 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -1386,6 +1386,10 @@ void SpdySession::OnPing(const spdy::SpdyPingControlFrame& frame) {
if (pings_in_flight_ > 0)
return;
+ // We will record RTT in histogram when there are no more client sent
+ // pings_in_flight_.
+ RecordPingRTTHistogram(base::TimeTicks::Now() - last_ping_sent_time_);
+
if (!need_to_send_ping_)
return;
@@ -1584,6 +1588,7 @@ void SpdySession::WritePingFrame(uint32 unique_id) {
++pings_in_flight_;
need_to_send_ping_ = false;
PlanToCheckPingStatus();
+ last_ping_sent_time_ = base::TimeTicks::Now();
}
}
@@ -1616,6 +1621,10 @@ void SpdySession::CheckPingStatus(base::TimeTicks last_check_time) {
if (delay.InMilliseconds() < 0 || received_data_time_ < last_check_time) {
CloseSessionOnError(net::ERR_SPDY_PING_FAILED, true);
+ // Track all failed PING messages in a separate bucket.
+ const base::TimeDelta kFailedPing =
+ base::TimeDelta::FromInternalValue(INT_MAX);
+ RecordPingRTTHistogram(kFailedPing);
return;
}
@@ -1626,6 +1635,10 @@ void SpdySession::CheckPingStatus(base::TimeTicks last_check_time) {
delay.InMilliseconds());
}
+void SpdySession::RecordPingRTTHistogram(base::TimeDelta duration) {
+ UMA_HISTOGRAM_TIMES("Net.SpdyPing.RTT", duration);
+}
+
void SpdySession::RecordHistograms() {
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPerSession",
streams_initiated_count_,
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index ac92b5e..e1bdd69 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -363,6 +363,8 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
bool Respond(const spdy::SpdyHeaderBlock& headers,
const scoped_refptr<SpdyStream> stream);
+
+ void RecordPingRTTHistogram(base::TimeDelta duration);
void RecordHistograms();
// Closes all streams. Used as part of shutdown.
@@ -514,6 +516,9 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// This is the next ping_id (unique_id) to be sent in PING frame.
uint32 next_ping_id_;
+ // This is the last time we have sent a PING.
+ base::TimeTicks last_ping_sent_time_;
+
// This is the last time we have received data.
base::TimeTicks received_data_time_;