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

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

Issue 462027: Use factory to create histograms, and refcounts to track lifetimes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « net/ftp/ftp_server_type_histograms.cc ('k') | net/socket_stream/socket_stream_metrics.cc » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/field_trial.h" 10 #include "base/field_trial.h"
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 !FieldTrial::MakeName("", "SocketLateBinding").empty(); 989 !FieldTrial::MakeName("", "SocketLateBinding").empty();
990 990
991 if (handle.reuse_type() == ClientSocketHandle::UNUSED) { 991 if (handle.reuse_type() == ClientSocketHandle::UNUSED) {
992 UMA_HISTOGRAM_CLIPPED_TIMES( 992 UMA_HISTOGRAM_CLIPPED_TIMES(
993 "Net.Dns_Resolution_And_TCP_Connection_Latency", 993 "Net.Dns_Resolution_And_TCP_Connection_Latency",
994 time_to_obtain_connected_socket, 994 time_to_obtain_connected_socket,
995 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 995 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
996 100); 996 100);
997 } 997 }
998 998
999 static LinearHistogram tcp_socket_type_counter( 999 static scoped_refptr<Histogram> tcp_socket_type_counter =
1000 "Net.TCPSocketType", 1000 LinearHistogram::LinearHistogramFactoryGet(
1001 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); 1001 "Net.TCPSocketType",
1002 tcp_socket_type_counter.SetFlags(kUmaTargetedHistogramFlag); 1002 1, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1);
1003 tcp_socket_type_counter.Add(handle.reuse_type()); 1003 tcp_socket_type_counter->SetFlags(kUmaTargetedHistogramFlag);
1004 tcp_socket_type_counter->Add(handle.reuse_type());
1004 1005
1005 if (use_late_binding_histogram) { 1006 if (use_late_binding_histogram) {
1006 static LinearHistogram tcp_socket_type_counter2( 1007 static scoped_refptr<Histogram> tcp_socket_type_counter2 =
1007 FieldTrial::MakeName("Net.TCPSocketType", "SocketLateBinding").data(), 1008 LinearHistogram::LinearHistogramFactoryGet(
1008 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); 1009 FieldTrial::MakeName("Net.TCPSocketType",
1009 tcp_socket_type_counter2.SetFlags(kUmaTargetedHistogramFlag); 1010 "SocketLateBinding").data(),
1010 tcp_socket_type_counter2.Add(handle.reuse_type()); 1011 1, ClientSocketHandle::NUM_TYPES,
1012 ClientSocketHandle::NUM_TYPES + 1);
1013 tcp_socket_type_counter2->SetFlags(kUmaTargetedHistogramFlag);
1014 tcp_socket_type_counter2->Add(handle.reuse_type());
1011 } 1015 }
1012 1016
1013 UMA_HISTOGRAM_CLIPPED_TIMES( 1017 UMA_HISTOGRAM_CLIPPED_TIMES(
1014 "Net.TransportSocketRequestTime", 1018 "Net.TransportSocketRequestTime",
1015 time_to_obtain_connected_socket, 1019 time_to_obtain_connected_socket,
1016 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 1020 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
1017 100); 1021 100);
1018 1022
1019 if (use_late_binding_histogram) { 1023 if (use_late_binding_histogram) {
1020 UMA_HISTOGRAM_CUSTOM_TIMES( 1024 UMA_HISTOGRAM_CUSTOM_TIMES(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 NOTREACHED(); 1062 NOTREACHED();
1059 break; 1063 break;
1060 } 1064 }
1061 } 1065 }
1062 1066
1063 void HttpNetworkTransaction::LogIOErrorMetrics( 1067 void HttpNetworkTransaction::LogIOErrorMetrics(
1064 const ClientSocketHandle& handle) { 1068 const ClientSocketHandle& handle) {
1065 static const bool use_late_binding_histogram = 1069 static const bool use_late_binding_histogram =
1066 !FieldTrial::MakeName("", "SocketLateBinding").empty(); 1070 !FieldTrial::MakeName("", "SocketLateBinding").empty();
1067 1071
1068 static LinearHistogram io_error_socket_type_counter( 1072 static scoped_refptr<Histogram> io_error_socket_type_counter =
1069 "Net.IOError_SocketReuseType", 1073 LinearHistogram::LinearHistogramFactoryGet(
1070 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); 1074 "Net.IOError_SocketReuseType",
1071 io_error_socket_type_counter.SetFlags(kUmaTargetedHistogramFlag); 1075 1, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1);
1072 io_error_socket_type_counter.Add(handle.reuse_type()); 1076 io_error_socket_type_counter->SetFlags(kUmaTargetedHistogramFlag);
1077 io_error_socket_type_counter->Add(handle.reuse_type());
1073 1078
1074 if (use_late_binding_histogram) { 1079 if (use_late_binding_histogram) {
1075 static LinearHistogram io_error_socket_type_counter( 1080 static scoped_refptr<Histogram> io_error_socket_type_counter =
1076 FieldTrial::MakeName("Net.IOError_SocketReuseType", 1081 LinearHistogram::LinearHistogramFactoryGet(
1077 "SocketLateBinding").data(), 1082 FieldTrial::MakeName("Net.IOError_SocketReuseType",
1078 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); 1083 "SocketLateBinding").data(),
1079 io_error_socket_type_counter.SetFlags(kUmaTargetedHistogramFlag); 1084 1, ClientSocketHandle::NUM_TYPES,
1080 io_error_socket_type_counter.Add(handle.reuse_type()); 1085 ClientSocketHandle::NUM_TYPES + 1);
1086 io_error_socket_type_counter->SetFlags(kUmaTargetedHistogramFlag);
1087 io_error_socket_type_counter->Add(handle.reuse_type());
1081 } 1088 }
1082 1089
1083 switch (handle.reuse_type()) { 1090 switch (handle.reuse_type()) {
1084 case ClientSocketHandle::UNUSED: 1091 case ClientSocketHandle::UNUSED:
1085 break; 1092 break;
1086 case ClientSocketHandle::UNUSED_IDLE: 1093 case ClientSocketHandle::UNUSED_IDLE:
1087 UMA_HISTOGRAM_CUSTOM_TIMES( 1094 UMA_HISTOGRAM_CUSTOM_TIMES(
1088 "Net.SocketIdleTimeOnIOError2_UnusedSocket", 1095 "Net.SocketIdleTimeOnIOError2_UnusedSocket",
1089 handle.idle_time(), base::TimeDelta::FromMilliseconds(1), 1096 handle.idle_time(), base::TimeDelta::FromMilliseconds(1),
1090 base::TimeDelta::FromMinutes(6), 100); 1097 base::TimeDelta::FromMinutes(6), 100);
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 AuthChallengeInfo* auth_info = new AuthChallengeInfo; 1691 AuthChallengeInfo* auth_info = new AuthChallengeInfo;
1685 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; 1692 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY;
1686 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin)); 1693 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin));
1687 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); 1694 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme());
1688 // TODO(eroman): decode realm according to RFC 2047. 1695 // TODO(eroman): decode realm according to RFC 2047.
1689 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); 1696 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm());
1690 http_stream_->GetResponseInfo()->auth_challenge = auth_info; 1697 http_stream_->GetResponseInfo()->auth_challenge = auth_info;
1691 } 1698 }
1692 1699
1693 } // namespace net 1700 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_server_type_histograms.cc ('k') | net/socket_stream/socket_stream_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698