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

Unified Diff: net/socket/ssl_client_socket.cc

Issue 590513002: Add histogram to track NPN/ALPN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: net/socket/ssl_client_socket.cc
diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc
index 4aacbc8d42db5faa1f4eb25cad3588efb37b752f..210f4d8a3c38d83d36aee7ad54d65635be94e558 100644
--- a/net/socket/ssl_client_socket.cc
+++ b/net/socket/ssl_client_socket.cc
@@ -5,6 +5,7 @@
#include "net/socket/ssl_client_socket.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/strings/string_util.h"
#include "crypto/ec_private_key.h"
#include "net/base/host_port_pair.h"
@@ -19,7 +20,8 @@ SSLClientSocket::SSLClientSocket()
protocol_negotiated_(kProtoUnknown),
channel_id_sent_(false),
signed_cert_timestamps_received_(false),
- stapled_ocsp_response_received_(false) {
+ stapled_ocsp_response_received_(false),
+ protocol_negotiation_(PN_UNKNOWN) {
}
// static
@@ -232,4 +234,22 @@ std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
return wire_protos;
}
+void SSLClientSocket::RecordProtocolNegotiation() {
+ if (protocol_negotiation_ == PN_UNKNOWN)
+ return;
+ std::string proto;
+ SSLClientSocket::NextProtoStatus status = GetNextProto(&proto);
+ if (status == kNextProtoUnsupported)
+ return;
+ if (status == kNextProtoNoOverlap) {
+ DCHECK(protocol_negotiation_ != PN_ALPN);
+ protocol_negotiation_ = PN_NPN_NO_OVERLAP;
+ }
+ NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto);
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "Net.SSLProtocolNegotiation",
+ static_cast<base::HistogramBase::Sample>(protocol_negotiation_) +
+ static_cast<base::HistogramBase::Sample>(protocol_negotiated));
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698