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

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

Issue 100112: Add a histogram to record the dns resolution + tcp connection times. (Closed)
Patch Set: Created 11 years, 7 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 | « net/http/http_network_transaction.h ('k') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/field_trial.h" 9 #include "base/field_trial.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 if (using_proxy_ || using_tunnel_) { 574 if (using_proxy_ || using_tunnel_) {
575 ProxyServer proxy_server = proxy_info_.proxy_server(); 575 ProxyServer proxy_server = proxy_info_.proxy_server();
576 host = proxy_server.host(); 576 host = proxy_server.host();
577 port = proxy_server.port(); 577 port = proxy_server.port();
578 } else { 578 } else {
579 // Direct connection 579 // Direct connection
580 host = request_->url.host(); 580 host = request_->url.host();
581 port = request_->url.EffectiveIntPort(); 581 port = request_->url.EffectiveIntPort();
582 } 582 }
583 583
584 host_resolution_start_time_ = base::Time::Now();
585
584 DidStartDnsResolution(host, this); 586 DidStartDnsResolution(host, this);
585 return resolver_.Resolve(host, port, &addresses_, &io_callback_); 587 return resolver_.Resolve(host, port, &addresses_, &io_callback_);
586 } 588 }
587 589
588 int HttpNetworkTransaction::DoResolveHostComplete(int result) { 590 int HttpNetworkTransaction::DoResolveHostComplete(int result) {
589 bool ok = (result == OK); 591 bool ok = (result == OK);
590 DidFinishDnsResolutionWithStatus(ok, request_->referrer, this); 592 DidFinishDnsResolutionWithStatus(ok, request_->referrer, this);
591 if (ok) { 593 if (ok) {
592 next_state_ = STATE_TCP_CONNECT; 594 next_state_ = STATE_TCP_CONNECT;
593 } else { 595 } else {
(...skipping 11 matching lines...) Expand all
605 607
606 ClientSocket* s = socket_factory_->CreateTCPClientSocket(addresses_); 608 ClientSocket* s = socket_factory_->CreateTCPClientSocket(addresses_);
607 connection_.set_socket(s); 609 connection_.set_socket(s);
608 return connection_.socket()->Connect(&io_callback_); 610 return connection_.socket()->Connect(&io_callback_);
609 } 611 }
610 612
611 int HttpNetworkTransaction::DoTCPConnectComplete(int result) { 613 int HttpNetworkTransaction::DoTCPConnectComplete(int result) {
612 // If we are using a direct SSL connection, then go ahead and establish the 614 // If we are using a direct SSL connection, then go ahead and establish the
613 // SSL connection, now. Otherwise, we need to first issue a CONNECT request. 615 // SSL connection, now. Otherwise, we need to first issue a CONNECT request.
614 if (result == OK) { 616 if (result == OK) {
615 LogTCPConnectionMetrics(); 617 LogTCPConnectedMetrics();
616 if (using_ssl_ && !using_tunnel_) { 618 if (using_ssl_ && !using_tunnel_) {
617 next_state_ = STATE_SSL_CONNECT; 619 next_state_ = STATE_SSL_CONNECT;
618 } else { 620 } else {
619 next_state_ = STATE_WRITE_HEADERS; 621 next_state_ = STATE_WRITE_HEADERS;
620 if (using_tunnel_) 622 if (using_tunnel_)
621 establishing_tunnel_ = true; 623 establishing_tunnel_ = true;
622 } 624 }
623 } else { 625 } else {
624 result = ReconsiderProxyAfterError(result); 626 result = ReconsiderProxyAfterError(result);
625 } 627 }
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 if (done) { 964 if (done) {
963 DidDrainBodyForAuthRestart(keep_alive); 965 DidDrainBodyForAuthRestart(keep_alive);
964 } else { 966 } else {
965 // Keep draining. 967 // Keep draining.
966 next_state_ = STATE_DRAIN_BODY_FOR_AUTH_RESTART; 968 next_state_ = STATE_DRAIN_BODY_FOR_AUTH_RESTART;
967 } 969 }
968 970
969 return OK; 971 return OK;
970 } 972 }
971 973
972 void HttpNetworkTransaction::LogTCPConnectionMetrics() const { 974 void HttpNetworkTransaction::LogTCPConnectedMetrics() const {
973 DCHECK(connect_start_time_ != base::Time()); 975 DCHECK(connect_start_time_ != base::Time());
974 base::TimeDelta connect_duration = 976 base::TimeDelta connect_duration =
975 base::Time::Now() - connect_start_time_; 977 base::Time::Now() - connect_start_time_;
976 978
977 UMA_HISTOGRAM_CLIPPED_TIMES(FieldTrial::MakeName( 979 UMA_HISTOGRAM_CLIPPED_TIMES(FieldTrial::MakeName(
978 "Net.TCP_Connection_Latency", "DnsImpact").data(), connect_duration, 980 "Net.TCP_Connection_Latency", "DnsImpact").data(), connect_duration,
979 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 981 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
980 100); 982 100);
983
984 base::TimeDelta host_resolution_and_tcp_connection_latency =
985 base::Time::Now() - host_resolution_start_time_;
986
987 UMA_HISTOGRAM_CLIPPED_TIMES(
988 FieldTrial::MakeName(
989 "Net.Dns_Resolution_And_TCP_Connection_Latency", "DnsImpact").data(),
990 host_resolution_and_tcp_connection_latency,
991 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
992 100);
981 } 993 }
982 994
983 void HttpNetworkTransaction::LogTransactionConnectedMetrics() const { 995 void HttpNetworkTransaction::LogTransactionConnectedMetrics() const {
984 base::TimeDelta total_duration = response_.response_time - start_time_; 996 base::TimeDelta total_duration = response_.response_time - start_time_;
985 997
986 UMA_HISTOGRAM_CLIPPED_TIMES( 998 UMA_HISTOGRAM_CLIPPED_TIMES(
987 FieldTrial::MakeName( 999 FieldTrial::MakeName(
988 "Net.Transaction_Connected_Under_10", 1000 "Net.Transaction_Connected_Under_10",
989 "DnsImpact").data(), 1001 "DnsImpact").data(),
990 total_duration, 1002 total_duration,
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 if (target == HttpAuth::AUTH_PROXY) { 1633 if (target == HttpAuth::AUTH_PROXY) {
1622 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port()); 1634 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port());
1623 } else { 1635 } else {
1624 DCHECK(target == HttpAuth::AUTH_SERVER); 1636 DCHECK(target == HttpAuth::AUTH_SERVER);
1625 auth_info->host = ASCIIToWide(request_->url.host()); 1637 auth_info->host = ASCIIToWide(request_->url.host());
1626 } 1638 }
1627 response_.auth_challenge = auth_info; 1639 response_.auth_challenge = auth_info;
1628 } 1640 }
1629 1641
1630 } // namespace net 1642 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698