diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-24 21:57:16 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-24 21:57:16 +0000 |
commit | 5e2e6c77d139c6708cc1b2c70556393b502b0e31 (patch) | |
tree | def701459295af71d69daa5a439a06ce2b562497 /net/base | |
parent | 1f99947ea71c8bde2dd662f9fb1b4949b11c68cc (diff) | |
download | chromium_src-5e2e6c77d139c6708cc1b2c70556393b502b0e31.zip chromium_src-5e2e6c77d139c6708cc1b2c70556393b502b0e31.tar.gz chromium_src-5e2e6c77d139c6708cc1b2c70556393b502b0e31.tar.bz2 |
Several fixes to the Net.ConnectionTypeCount histogram.
* Previously, the "CONNECTION_ANY" was incorrectly recorded. It was recording
every Http *transaction*, not every Http connection.
* The histogram was vague about whether it was tracking successful or
unsuccessful connections. In fact, it was recording all SSL connections (fail
or success), and yet only successful HTTP connections. Modified to only apply
to successful connections.
* Added a Net.ConnectionTypeFailCount histogram which counts the number of
failed connections by type.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/519002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35264 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/connection_type_histograms.cc | 27 | ||||
-rw-r--r-- | net/base/connection_type_histograms.h | 8 |
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 |