Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: net/http/http_basic_stream.cc

Issue 7714020: Removing old histograms for measuring RTT vs Kilobytes of data (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_basic_stream.h" 5 #include "net/http/http_basic_stream.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 int64 total_bytes_read = connection_->socket()->NumBytesRead(); 135 int64 total_bytes_read = connection_->socket()->NumBytesRead();
136 int64 bytes_received = total_bytes_read - bytes_read_offset_; 136 int64 bytes_received = total_bytes_read - bytes_read_offset_;
137 int64 num_kb = bytes_received / 1024; 137 int64 num_kb = bytes_received / 1024;
138 double rtt = connection_->socket()->GetConnectTimeMicros().ToInternalValue(); 138 double rtt = connection_->socket()->GetConnectTimeMicros().ToInternalValue();
139 rtt /= 1000.0; 139 rtt /= 1000.0;
140 140
141 if (num_kb < 1024 && rtt > 0) { // Ignore responses > 1MB 141 if (num_kb < 1024 && rtt > 0) { // Ignore responses > 1MB
142 base::TimeDelta duration = base::Time::Now() - 142 base::TimeDelta duration = base::Time::Now() -
143 response_->request_time; 143 response_->request_time;
144 double num_rtt = static_cast<double>(duration.InMilliseconds()) / rtt; 144 double num_rtt = static_cast<double>(duration.InMilliseconds()) / rtt;
145 int64 num_rtt_scaled = (4 * num_rtt);
146
147 static const char* const kGroups[] = {
148 "warmest_socket", "warm_socket", "last_accessed_socket"
149 };
150 int bucket = (num_kb / 5) * 5;
151 const std::string histogram(StringPrintf("Net.Num_RTT_vs_KB_%s_%dKB",
152 kGroups[socket_reuse_policy],
153 bucket));
154 base::Histogram* counter = base::Histogram::FactoryGet(
155 histogram, 0, 1000, 2, base::Histogram::kUmaTargetedHistogramFlag);
156 DCHECK_EQ(histogram, counter->histogram_name());
157 counter->Add(num_rtt_scaled);
158 145
159 VLOG(2) << StringPrintf("%s\nrtt = %f\tnum_rtt = %f\t" 146 VLOG(2) << StringPrintf("%s\nrtt = %f\tnum_rtt = %f\t"
jar (doing other things) 2011/08/23 23:01:35 What does VLOG do? IMO, this should all be debug
gagansingh 2011/08/24 00:03:29 This log was very helpful in the initial developme
160 "num_kb = %" PRId64 "\t" 147 "num_kb = %" PRId64 "\t"
161 "total bytes = %" PRId64 "\t" 148 "total bytes = %" PRId64,
162 "histogram = %s",
163 request_line_.data(), 149 request_line_.data(),
164 rtt, num_rtt, num_kb, total_bytes_read, 150 rtt, num_rtt, num_kb, total_bytes_read);
165 histogram.data());
166 } 151 }
167 } 152 }
168 153
169 } // namespace net 154 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698