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

Unified Diff: net/socket/client_socket_pool_base.cc

Issue 2086903003: net: Add some metrics on reuse of idle sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: response Created 4 years, 6 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_pool_base.cc
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 8853c1e80305d6fad694f12dbc0b47cb39b7f7de..9a9a166615c7280200a7da14875f33b2cedadcdf 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -11,6 +11,7 @@
#include "base/format_macros.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
@@ -975,11 +976,21 @@ void ClientSocketPoolBaseHelper::HandOutSocket(
handle->set_pool_id(pool_generation_number_);
handle->set_connect_timing(connect_timing);
- if (handle->is_reused()) {
+ if (reuse_type == ClientSocketHandle::REUSED_IDLE) {
net_log.AddEvent(
NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET,
NetLog::IntCallback("idle_ms",
static_cast<int>(idle_time.InMilliseconds())));
+
+ UMA_HISTOGRAM_COUNTS_1000("Net.Socket.IdleSocketReuseTime",
+ idle_time.InSeconds());
+ }
+
+ if (reuse_type != ClientSocketHandle::UNUSED) {
+ // The socket being handed out is no longer considered idle, but was
+ // considered idle until just before this method was called.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Net.Socket.NumIdleSockets",
+ idle_socket_count() + 1, 1, 256, 50);
}
net_log.AddEvent(
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698