diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-30 17:46:16 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-30 17:46:16 +0000 |
commit | 75e287db9508753ada184ee4252b679912f6f085 (patch) | |
tree | 34a7c6c90927d9ec9ba251b6c427d2c72a4931da /net | |
parent | 4b77038ebde3dadd45939b171b181b901544236e (diff) | |
download | chromium_src-75e287db9508753ada184ee4252b679912f6f085.zip chromium_src-75e287db9508753ada184ee4252b679912f6f085.tar.gz chromium_src-75e287db9508753ada184ee4252b679912f6f085.tar.bz2 |
Add a histogram to measure the number of idle sockets when a TCP connection is established.
Review URL: http://codereview.chromium.org/99205
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/client_socket_handle.h | 1 | ||||
-rw-r--r-- | net/base/client_socket_pool.cc | 8 | ||||
-rw-r--r-- | net/base/client_socket_pool.h | 3 | ||||
-rw-r--r-- | net/http/http_network_transaction.cc | 6 |
4 files changed, 18 insertions, 0 deletions
diff --git a/net/base/client_socket_handle.h b/net/base/client_socket_handle.h index e0d9e73..1328369 100644 --- a/net/base/client_socket_handle.h +++ b/net/base/client_socket_handle.h @@ -62,6 +62,7 @@ class ClientSocketHandle { bool is_initialized() const { return socket_ != NULL; } // These may only be used if is_initialized() is true. + const std::string& group_name() const { return group_name_; } ClientSocket* socket() { return socket_->get(); } ClientSocket* release_socket() { return socket_->release(); } void set_socket(ClientSocket* s) { socket_->reset(s); } diff --git a/net/base/client_socket_pool.cc b/net/base/client_socket_pool.cc index 651fbe2..4171b0c 100644 --- a/net/base/client_socket_pool.cc +++ b/net/base/client_socket_pool.cc @@ -122,6 +122,14 @@ void ClientSocketPool::CloseIdleSockets() { CleanupIdleSockets(true); } +int ClientSocketPool::IdleSocketCountInGroup( + const std::string& group_name) const { + GroupMap::const_iterator i = group_map_.find(group_name); + DCHECK(i != group_map_.end()); + + return i->second.idle_sockets.size(); +} + bool ClientSocketPool::IdleSocket::ShouldCleanup(base::TimeTicks now) const { bool timed_out = (now - start_time) >= base::TimeDelta::FromSeconds(kIdleTimeout); diff --git a/net/base/client_socket_pool.h b/net/base/client_socket_pool.h index dd08c24..6c92f37 100644 --- a/net/base/client_socket_pool.h +++ b/net/base/client_socket_pool.h @@ -73,6 +73,9 @@ class ClientSocketPool : public base::RefCounted<ClientSocketPool> { return idle_socket_count_; } + // The total number of idle sockets in a connection group. + int IdleSocketCountInGroup(const std::string& group_name) const; + private: friend class base::RefCounted<ClientSocketPool>; diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 3c84234..f4fefcc4 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -1033,6 +1033,12 @@ void HttpNetworkTransaction::LogTCPConnectedMetrics() const { host_resolution_and_tcp_connection_latency, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); + + UMA_HISTOGRAM_COUNTS_100( + FieldTrial::MakeName( + "Net.TCP_Connection_Idle_Sockets", "DnsImpact").data(), + session_->connection_pool()->IdleSocketCountInGroup( + connection_.group_name())); } void HttpNetworkTransaction::LogTransactionConnectedMetrics() const { |