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

Unified Diff: net/socket/tcp_client_socket.cc

Issue 1215543003: Add UMA for the kernel's TCP RTT estimate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add WARN_UNUSED_RESULT. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/tcp_client_socket.h ('k') | net/socket/tcp_socket_libevent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/socket/tcp_client_socket.h ('k') | net/socket/tcp_socket_libevent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698