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

Unified Diff: net/base/connection_type_histograms.cc

Issue 17471: Measure how often the users are encountering MD5... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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/base/connection_type_histograms.h ('k') | net/base/ssl_client_socket_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/connection_type_histograms.cc
===================================================================
--- net/base/connection_type_histograms.cc (revision 0)
+++ net/base/connection_type_histograms.cc (revision 0)
@@ -0,0 +1,38 @@
+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/connection_type_histograms.h"
+
+#include "base/histogram.h"
+
+namespace net {
+
+// We're using a histogram as a group of counters. We're only interested in
+// the values of the counters. Ignore the shape, average, and standard
+// deviation of the histograms because they are meaningless.
+//
+// We use two groups of counters. In the first group (counter1), each counter
+// is a boolean (0 or 1) that indicates whether the user has seen a connection
+// of that type during that session. In the second group (counter2), each
+// counter is the number of connections of that type the user has seen during
+// that session.
+void UpdateConnectionTypeHistograms(ConnectionType type) {
+ static bool had_connection_type[NUM_OF_CONNECTION_TYPES];
+ static LinearHistogram counter1(L"Net.HadConnectionType",
+ 1, NUM_OF_CONNECTION_TYPES - 1,
+ NUM_OF_CONNECTION_TYPES);
+ static LinearHistogram counter2(L"Net.ConnectionTypeCount",
+ 1, NUM_OF_CONNECTION_TYPES - 1,
+ NUM_OF_CONNECTION_TYPES);
+
+ if (type >= 0 && type < NUM_OF_CONNECTION_TYPES) {
+ if (!had_connection_type[type]) {
+ had_connection_type[type] = true;
+ counter1.Add(type);
+ }
+ }
+ counter2.Add(type);
+}
+
+} // namespace net
Property changes on: net\base\connection_type_histograms.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/base/connection_type_histograms.h ('k') | net/base/ssl_client_socket_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698