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

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 546133002: Add a new histogram for tracking how much time is spent resolving hosts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/quic/quic_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 SingleRequestHostResolver host_resolver_; 204 SingleRequestHostResolver host_resolver_;
205 QuicServerId server_id_; 205 QuicServerId server_id_;
206 bool is_post_; 206 bool is_post_;
207 bool was_alternate_protocol_recently_broken_; 207 bool was_alternate_protocol_recently_broken_;
208 scoped_ptr<QuicServerInfo> server_info_; 208 scoped_ptr<QuicServerInfo> server_info_;
209 const BoundNetLog net_log_; 209 const BoundNetLog net_log_;
210 QuicClientSession* session_; 210 QuicClientSession* session_;
211 CompletionCallback callback_; 211 CompletionCallback callback_;
212 AddressList address_list_; 212 AddressList address_list_;
213 base::TimeTicks disk_cache_load_start_time_; 213 base::TimeTicks disk_cache_load_start_time_;
214 base::TimeTicks dns_resolution_start_time_;
214 base::WeakPtrFactory<Job> weak_factory_; 215 base::WeakPtrFactory<Job> weak_factory_;
215 DISALLOW_COPY_AND_ASSIGN(Job); 216 DISALLOW_COPY_AND_ASSIGN(Job);
216 }; 217 };
217 218
218 QuicStreamFactory::Job::Job(QuicStreamFactory* factory, 219 QuicStreamFactory::Job::Job(QuicStreamFactory* factory,
219 HostResolver* host_resolver, 220 HostResolver* host_resolver,
220 const HostPortPair& host_port_pair, 221 const HostPortPair& host_port_pair,
221 bool is_https, 222 bool is_https,
222 bool was_alternate_protocol_recently_broken, 223 bool was_alternate_protocol_recently_broken,
223 PrivacyMode privacy_mode, 224 PrivacyMode privacy_mode,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 309 }
309 310
310 int QuicStreamFactory::Job::DoResolveHost() { 311 int QuicStreamFactory::Job::DoResolveHost() {
311 // Start loading the data now, and wait for it after we resolve the host. 312 // Start loading the data now, and wait for it after we resolve the host.
312 if (server_info_) { 313 if (server_info_) {
313 disk_cache_load_start_time_ = base::TimeTicks::Now(); 314 disk_cache_load_start_time_ = base::TimeTicks::Now();
314 server_info_->Start(); 315 server_info_->Start();
315 } 316 }
316 317
317 io_state_ = STATE_RESOLVE_HOST_COMPLETE; 318 io_state_ = STATE_RESOLVE_HOST_COMPLETE;
319 dns_resolution_start_time_ = base::TimeTicks::Now();
318 return host_resolver_.Resolve( 320 return host_resolver_.Resolve(
319 HostResolver::RequestInfo(server_id_.host_port_pair()), 321 HostResolver::RequestInfo(server_id_.host_port_pair()),
320 DEFAULT_PRIORITY, 322 DEFAULT_PRIORITY,
321 &address_list_, 323 &address_list_,
322 base::Bind(&QuicStreamFactory::Job::OnIOComplete, 324 base::Bind(&QuicStreamFactory::Job::OnIOComplete,
323 weak_factory_.GetWeakPtr()), 325 weak_factory_.GetWeakPtr()),
324 net_log_); 326 net_log_);
325 } 327 }
326 328
327 int QuicStreamFactory::Job::DoResolveHostComplete(int rv) { 329 int QuicStreamFactory::Job::DoResolveHostComplete(int rv) {
330 UMA_HISTOGRAM_TIMES("Net.QuicSession.HostResolutionTime",
331 base::TimeTicks::Now() - dns_resolution_start_time_);
328 if (rv != OK) 332 if (rv != OK)
329 return rv; 333 return rv;
330 334
331 DCHECK(!factory_->HasActiveSession(server_id_)); 335 DCHECK(!factory_->HasActiveSession(server_id_));
332 336
333 // Inform the factory of this resolution, which will set up 337 // Inform the factory of this resolution, which will set up
334 // a session alias, if possible. 338 // a session alias, if possible.
335 if (factory_->OnResolution(server_id_, address_list_)) { 339 if (factory_->OnResolution(server_id_, address_list_)) {
336 return OK; 340 return OK;
337 } 341 }
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 http_server_properties_->ClearAlternateProtocol(server); 980 http_server_properties_->ClearAlternateProtocol(server);
977 http_server_properties_->SetAlternateProtocol( 981 http_server_properties_->SetAlternateProtocol(
978 server, alternate.port, alternate.protocol, 1); 982 server, alternate.port, alternate.protocol, 1);
979 DCHECK_EQ(QUIC, 983 DCHECK_EQ(QUIC,
980 http_server_properties_->GetAlternateProtocol(server).protocol); 984 http_server_properties_->GetAlternateProtocol(server).protocol);
981 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( 985 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
982 server)); 986 server));
983 } 987 }
984 988
985 } // namespace net 989 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698