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

Side by Side Diff: net/base/connection_type_histograms.cc

Issue 28046: Use string for Histogram names since these are all ASCII anyway wide-characte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/views/focus_manager.cc ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/connection_type_histograms.h" 5 #include "net/base/connection_type_histograms.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 // We're using a histogram as a group of counters. We're only interested in 11 // We're using a histogram as a group of counters. We're only interested in
12 // the values of the counters. Ignore the shape, average, and standard 12 // the values of the counters. Ignore the shape, average, and standard
13 // deviation of the histograms because they are meaningless. 13 // deviation of the histograms because they are meaningless.
14 // 14 //
15 // We use two groups of counters. In the first group (counter1), each counter 15 // We use two groups of counters. In the first group (counter1), each counter
16 // is a boolean (0 or 1) that indicates whether the user has seen a connection 16 // is a boolean (0 or 1) that indicates whether the user has seen a connection
17 // of that type during that session. In the second group (counter2), each 17 // of that type during that session. In the second group (counter2), each
18 // counter is the number of connections of that type the user has seen during 18 // counter is the number of connections of that type the user has seen during
19 // that session. 19 // that session.
20 // 20 //
21 // Each histogram has an unused bucket at the end to allow seamless future 21 // Each histogram has an unused bucket at the end to allow seamless future
22 // expansion. 22 // expansion.
23 void UpdateConnectionTypeHistograms(ConnectionType type) { 23 void UpdateConnectionTypeHistograms(ConnectionType type) {
24 static bool had_connection_type[NUM_OF_CONNECTION_TYPES]; 24 static bool had_connection_type[NUM_OF_CONNECTION_TYPES];
25 static LinearHistogram counter1(L"Net.HadConnectionType", 25 static LinearHistogram counter1("Net.HadConnectionType",
26 1, NUM_OF_CONNECTION_TYPES, 26 1, NUM_OF_CONNECTION_TYPES,
27 NUM_OF_CONNECTION_TYPES + 1); 27 NUM_OF_CONNECTION_TYPES + 1);
28 static LinearHistogram counter2(L"Net.ConnectionTypeCount", 28 static LinearHistogram counter2("Net.ConnectionTypeCount",
29 1, NUM_OF_CONNECTION_TYPES, 29 1, NUM_OF_CONNECTION_TYPES,
30 NUM_OF_CONNECTION_TYPES + 1); 30 NUM_OF_CONNECTION_TYPES + 1);
31 31
32 if (type >= 0 && type < NUM_OF_CONNECTION_TYPES) { 32 if (type >= 0 && type < NUM_OF_CONNECTION_TYPES) {
33 if (!had_connection_type[type]) { 33 if (!had_connection_type[type]) {
34 had_connection_type[type] = true; 34 had_connection_type[type] = true;
35 counter1.SetFlags(kUmaTargetedHistogramFlag); 35 counter1.SetFlags(kUmaTargetedHistogramFlag);
36 counter1.Add(type); 36 counter1.Add(type);
37 } 37 }
38 } 38 }
39 counter2.SetFlags(kUmaTargetedHistogramFlag); 39 counter2.SetFlags(kUmaTargetedHistogramFlag);
40 counter2.Add(type); 40 counter2.Add(type);
41 } 41 }
42 42
43 } // namespace net 43 } // namespace net
OLDNEW
« no previous file with comments | « chrome/views/focus_manager.cc ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698