diff options
author | gagansingh@google.com <gagansingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-27 08:18:52 +0000 |
---|---|---|
committer | gagansingh@google.com <gagansingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-27 08:18:52 +0000 |
commit | 14603e24bc0348af3a60fdc7ce2a232f653150ab (patch) | |
tree | 9cab1c7bc600d9116cae8ed3b65b10c431cc7c2e /net | |
parent | f746f106ecf8d4adb89fe40d015ec99ff78ea732 (diff) | |
download | chromium_src-14603e24bc0348af3a60fdc7ce2a232f653150ab.zip chromium_src-14603e24bc0348af3a60fdc7ce2a232f653150ab.tar.gz chromium_src-14603e24bc0348af3a60fdc7ce2a232f653150ab.tar.bz2 |
Previously i was recording number of RTT's vs Kilobytes of data downloaded per http transaction. This was generating lots of histograms.
Removing them for efficiency.
Review URL: http://codereview.chromium.org/7714020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_basic_stream.cc | 38 | ||||
-rw-r--r-- | net/http/http_network_transaction_unittest.cc | 28 |
2 files changed, 1 insertions, 65 deletions
diff --git a/net/http/http_basic_stream.cc b/net/http/http_basic_stream.cc index 08785b8..7c79d40 100644 --- a/net/http/http_basic_stream.cc +++ b/net/http/http_basic_stream.cc @@ -127,43 +127,7 @@ bool HttpBasicStream::IsSpdyHttpStream() const { } void HttpBasicStream::LogNumRttVsBytesMetrics() const { - int socket_reuse_policy = GetSocketReusePolicy(); - if (socket_reuse_policy > 2 || socket_reuse_policy < 0) { - return; - } - - int64 total_bytes_read = connection_->socket()->NumBytesRead(); - int64 bytes_received = total_bytes_read - bytes_read_offset_; - int64 num_kb = bytes_received / 1024; - double rtt = connection_->socket()->GetConnectTimeMicros().ToInternalValue(); - rtt /= 1000.0; - - if (num_kb < 1024 && rtt > 0) { // Ignore responses > 1MB - base::TimeDelta duration = base::Time::Now() - - response_->request_time; - double num_rtt = static_cast<double>(duration.InMilliseconds()) / rtt; - int64 num_rtt_scaled = (4 * num_rtt); - - static const char* const kGroups[] = { - "warmest_socket", "warm_socket", "last_accessed_socket" - }; - int bucket = (num_kb / 5) * 5; - const std::string histogram(StringPrintf("Net.Num_RTT_vs_KB_%s_%dKB", - kGroups[socket_reuse_policy], - bucket)); - base::Histogram* counter = base::Histogram::FactoryGet( - histogram, 0, 1000, 2, base::Histogram::kUmaTargetedHistogramFlag); - DCHECK_EQ(histogram, counter->histogram_name()); - counter->Add(num_rtt_scaled); - - VLOG(2) << StringPrintf("%s\nrtt = %f\tnum_rtt = %f\t" - "num_kb = %" PRId64 "\t" - "total bytes = %" PRId64 "\t" - "histogram = %s", - request_line_.data(), - rtt, num_rtt, num_kb, total_bytes_read, - histogram.data()); - } + // Log rtt metrics here. } } // namespace net diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index a93812d..402d2c4 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -333,34 +333,6 @@ static const char kExpectedNPNString[] = "\x08http/1.1\x06spdy/2"; static const char kAlternateProtocolHttpHeader[] = "Alternate-Protocol: 443:npn-spdy/2\r\n\r\n"; -TEST_F(HttpNetworkTransactionTest, LogNumRttVsBytesMetrics_WarmestSocket) { - MockRead data_reads[1000]; - data_reads[0] = MockRead("HTTP/1.0 200 OK\r\n\r\n"); - for (int i = 1; i < 999; i++) { - data_reads[i] = MockRead("Gagan is a good boy!"); - } - data_reads[999] = MockRead(false, OK); - - net::SetSocketReusePolicy(0); - SimpleGetHelperResult out = SimpleGetHelper(data_reads, - arraysize(data_reads)); - - base::Histogram* histogram = NULL; - base::StatisticsRecorder::FindHistogram( - "Net.Num_RTT_vs_KB_warmest_socket_15KB", &histogram); - CHECK(histogram); - - base::Histogram::SampleSet sample_set; - histogram->SnapshotSample(&sample_set); - EXPECT_EQ(1, sample_set.TotalCount()); - - EXPECT_EQ(OK, out.rv); - EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); -} - -// TODO(gagansingh): Add test for LogNumRttVsBytesMetrics_LastAccessSocket once -// it is possible to clear histograms from previous tests. - TEST_F(HttpNetworkTransactionTest, Basic) { SessionDependencies session_deps; scoped_ptr<HttpTransaction> trans( |