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

Unified Diff: net/http/http_proxy_client_socket_wrapper.cc

Issue 2768173002: Record the time duration for establishing proxy connection (Closed)
Patch Set: Created 3 years, 9 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/http/http_proxy_client_socket_wrapper.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket_wrapper.cc
diff --git a/net/http/http_proxy_client_socket_wrapper.cc b/net/http/http_proxy_client_socket_wrapper.cc
index b209a5af46710d743f896bf013eb89e474ea56ae..de4e7d7a63e6f9e8708f6e00b8d7cfb5bbb774fc 100644
--- a/net/http/http_proxy_client_socket_wrapper.cc
+++ b/net/http/http_proxy_client_socket_wrapper.cc
@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
+#include "base/metrics/histogram_macros.h"
#include "base/profiler/scoped_tracker.h"
#include "base/values.h"
#include "net/base/proxy_delegate.h"
@@ -387,6 +388,7 @@ int HttpProxyClientSocketWrapper::DoLoop(int result) {
}
int HttpProxyClientSocketWrapper::DoBeginConnect() {
+ connect_start_time_ = base::TimeTicks::Now();
SetConnectTimer(connect_timeout_duration_);
if (transport_params_) {
next_state_ = STATE_TCP_CONNECT;
@@ -501,6 +503,14 @@ int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) {
int HttpProxyClientSocketWrapper::DoHttpProxyConnect() {
next_state_ = STATE_HTTP_PROXY_CONNECT_COMPLETE;
+ if (transport_params_) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.Proxy.ConnectLatency.Insecure.Success",
+ base::TimeTicks::Now() - connect_start_time_);
+ } else {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.Proxy.ConnectLatency.Secure.Success",
+ base::TimeTicks::Now() - connect_start_time_);
mmenke 2017/03/27 16:36:33 These names should make it clear that they're only
tbansal1 2017/03/27 18:29:30 Done.
+ }
+
// Add a HttpProxy connection on top of the tcp socket.
transport_socket_.reset(new HttpProxyClientSocket(
transport_socket_handle_.release(), user_agent_, endpoint_,
@@ -618,6 +628,17 @@ void HttpProxyClientSocketWrapper::ConnectTimeout() {
DCHECK_NE(STATE_NONE, next_state_);
DCHECK(!connect_callback_.is_null());
+ if (next_state_ == STATE_TCP_CONNECT_COMPLETE ||
+ next_state_ == STATE_SSL_CONNECT_COMPLETE) {
mmenke 2017/03/27 16:39:11 One other question: What about other errors? Loo
tbansal1 2017/03/27 18:29:30 Yes, this histogram records time until only the ti
+ if (transport_params_) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.Proxy.ConnectLatency.Insecure.TimedOut",
+ base::TimeTicks::Now() - connect_start_time_);
+ } else {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.Proxy.ConnectLatency.Secure.TimedOut",
+ base::TimeTicks::Now() - connect_start_time_);
+ }
+ }
+
NotifyProxyDelegateOfCompletion(ERR_CONNECTION_TIMED_OUT);
CompletionCallback callback = connect_callback_;
« no previous file with comments | « net/http/http_proxy_client_socket_wrapper.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698