| Index: net/socket/tcp_client_socket.cc
|
| diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc
|
| index a1c1fadb85e2b8ba0d01c600c760536f7e206eeb..78b24de7b15afe0c23c69089b8961ca471017b5c 100644
|
| --- a/net/socket/tcp_client_socket.cc
|
| +++ b/net/socket/tcp_client_socket.cc
|
| @@ -6,7 +6,9 @@
|
|
|
| #include "base/callback_helpers.h"
|
| #include "base/logging.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/profiler/scoped_tracker.h"
|
| +#include "base/time/time.h"
|
| #include "net/base/io_buffer.h"
|
| #include "net/base/ip_endpoint.h"
|
| #include "net/base/net_errors.h"
|
| @@ -38,6 +40,7 @@ TCPClientSocket::TCPClientSocket(scoped_ptr<TCPSocket> connected_socket,
|
| }
|
|
|
| TCPClientSocket::~TCPClientSocket() {
|
| + Disconnect();
|
| }
|
|
|
| int TCPClientSocket::Bind(const IPEndPoint& address) {
|
| @@ -184,6 +187,7 @@ void TCPClientSocket::Disconnect() {
|
| }
|
|
|
| void TCPClientSocket::DoDisconnect() {
|
| + EmitTCPMetricsHistogramsOnDisconnect();
|
| // If connecting or already connected, record that the socket has been
|
| // disconnected.
|
| previously_disconnected_ = socket_->IsValid() && current_address_index_ >= 0;
|
| @@ -350,4 +354,13 @@ int TCPClientSocket::OpenSocket(AddressFamily family) {
|
| return OK;
|
| }
|
|
|
| +void TCPClientSocket::EmitTCPMetricsHistogramsOnDisconnect() {
|
| + base::TimeDelta rtt;
|
| + if (socket_->GetEstimatedRoundTripTime(&rtt)) {
|
| + UMA_HISTOGRAM_CUSTOM_TIMES("Net.TcpRtt.AtDisconnect", rtt,
|
| + base::TimeDelta::FromMilliseconds(1),
|
| + base::TimeDelta::FromMinutes(10), 100);
|
| + }
|
| +}
|
| +
|
| } // namespace net
|
|
|