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

Side by Side Diff: base/metrics/histogram_base.cc

Issue 11342060: Histogram type support in HistogramBase and remove SetRangeDescription function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove "using" from metrics.cc Created 8 years, 1 month 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 | « base/metrics/histogram_base.h ('k') | base/metrics/sparse_histogram.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/metrics/histogram_base.h" 5 #include "base/metrics/histogram_base.h"
6 6
7 #include <climits> 7 #include <climits>
8 8
9 #include "base/logging.h"
9 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 13
13 namespace base { 14 namespace base {
14 15
16 std::string HistogramTypeToString(HistogramType type) {
17 switch(type) {
18 case HISTOGRAM:
19 return "HISTOGRAM";
20 case LINEAR_HISTOGRAM:
21 return "LINEAR_HISTOGRAM";
22 case BOOLEAN_HISTOGRAM:
23 return "BOOLEAN_HISTOGRAM";
24 case CUSTOM_HISTOGRAM:
25 return "CUSTOM_HISTOGRAM";
26 case SPARSE_HISTOGRAM:
27 return "SPARSE_HISTOGRAM";
28 default:
29 NOTREACHED();
30 }
31 return "UNKNOWN";
32 }
33
15 const HistogramBase::Sample HistogramBase::kSampleType_MAX = INT_MAX; 34 const HistogramBase::Sample HistogramBase::kSampleType_MAX = INT_MAX;
16 35
17 HistogramBase::HistogramBase(const std::string& name) 36 HistogramBase::HistogramBase(const std::string& name)
18 : histogram_name_(name), 37 : histogram_name_(name),
19 flags_(kNoFlags) {} 38 flags_(kNoFlags) {}
20 39
21 HistogramBase::~HistogramBase() {} 40 HistogramBase::~HistogramBase() {}
22 41
23 void HistogramBase::SetFlags(int32 flags) { 42 void HistogramBase::SetFlags(int32 flags) {
24 flags_ |= flags; 43 flags_ |= flags;
(...skipping 14 matching lines...) Expand all
39 DictionaryValue root; 58 DictionaryValue root;
40 root.SetString("name", histogram_name()); 59 root.SetString("name", histogram_name());
41 root.SetInteger("count", count); 60 root.SetInteger("count", count);
42 root.SetInteger("flags", flags()); 61 root.SetInteger("flags", flags());
43 root.Set("params", parameters.release()); 62 root.Set("params", parameters.release());
44 root.Set("buckets", buckets.release()); 63 root.Set("buckets", buckets.release());
45 serializer.Serialize(root); 64 serializer.Serialize(root);
46 } 65 }
47 66
48 } // namespace base 67 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/sparse_histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698