summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
Diffstat (limited to 'net/base')
-rw-r--r--net/base/connection_type_histograms.cc27
-rw-r--r--net/base/connection_type_histograms.h8
2 files changed, 24 insertions, 11 deletions
diff --git a/net/base/connection_type_histograms.cc b/net/base/connection_type_histograms.cc
index d200bde..81affa5 100644
--- a/net/base/connection_type_histograms.cc
+++ b/net/base/connection_type_histograms.cc
@@ -20,26 +20,35 @@ namespace net {
//
// Each histogram has an unused bucket at the end to allow seamless future
// expansion.
-void UpdateConnectionTypeHistograms(ConnectionType type) {
+void UpdateConnectionTypeHistograms(ConnectionType type, bool success) {
static bool had_connection_type[NUM_OF_CONNECTION_TYPES];
- static scoped_refptr<Histogram> counter1 =
- LinearHistogram::LinearHistogramFactoryGet("Net.HadConnectionType",
+ static scoped_refptr<Histogram> had_histogram =
+ LinearHistogram::LinearHistogramFactoryGet("Net.HadConnectionType2",
1, NUM_OF_CONNECTION_TYPES,
NUM_OF_CONNECTION_TYPES + 1);
- static scoped_refptr<Histogram> counter2 =
- LinearHistogram::LinearHistogramFactoryGet("Net.ConnectionTypeCount",
+ static scoped_refptr<Histogram> success_histogram =
+ LinearHistogram::LinearHistogramFactoryGet("Net.ConnectionTypeCount2",
+ 1, NUM_OF_CONNECTION_TYPES,
+ NUM_OF_CONNECTION_TYPES + 1);
+ static scoped_refptr<Histogram> failed_histogram =
+ LinearHistogram::LinearHistogramFactoryGet("Net.ConnectionTypeFailCount2",
1, NUM_OF_CONNECTION_TYPES,
NUM_OF_CONNECTION_TYPES + 1);
if (type >= 0 && type < NUM_OF_CONNECTION_TYPES) {
if (!had_connection_type[type]) {
had_connection_type[type] = true;
- counter1->SetFlags(kUmaTargetedHistogramFlag);
- counter1->Add(type);
+ had_histogram->SetFlags(kUmaTargetedHistogramFlag);
+ had_histogram->Add(type);
}
+
+ Histogram* histogram;
+ histogram = success ? success_histogram.get() : failed_histogram.get();
+ histogram->SetFlags(kUmaTargetedHistogramFlag);
+ histogram->Add(type);
+ } else {
+ NOTREACHED(); // Someone's logging an invalid type!
}
- counter2->SetFlags(kUmaTargetedHistogramFlag);
- counter2->Add(type);
}
} // namespace net
diff --git a/net/base/connection_type_histograms.h b/net/base/connection_type_histograms.h
index bea070c..c8517ff 100644
--- a/net/base/connection_type_histograms.h
+++ b/net/base/connection_type_histograms.h
@@ -15,7 +15,7 @@
namespace net {
enum ConnectionType {
- CONNECTION_ANY = 0, // Any connection, SSL or not
+ CONNECTION_ANY = 0, // Any connection (SSL, HTTP, SPDY, etc)
CONNECTION_SSL = 1, // An SSL connection
CONNECTION_SSL_MD5 = 2, // An SSL connection with an MD5 certificate in
// the certificate chain (excluding root)
@@ -27,10 +27,14 @@ enum ConnectionType {
// in the certificate chain (excluding root)
CONNECTION_SSL_MD2_CA = 6, // An SSL connection with an MD2 CA certificate
// in the certificate chain (excluding root)
+ CONNECTION_HTTP = 7, // An HTTP connection
+ CONNECTION_SPDY = 8, // A SPDY connection
NUM_OF_CONNECTION_TYPES
};
-void UpdateConnectionTypeHistograms(ConnectionType type);
+// Update the connection type histograms. |type| is the connection type.
+// |success| is whether or not the connection was successful or not.
+void UpdateConnectionTypeHistograms(ConnectionType type, bool success);
} // namespace net