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

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

Issue 10830156: Skeleton code of SparseHistogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
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 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ 5 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_
6 #define BASE_METRICS_HISTOGRAM_BASE_H_ 6 #define BASE_METRICS_HISTOGRAM_BASE_H_
7 7
8 #include <climits> 8 #include <climits>
9 #include <string> 9 #include <string>
10 10
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/basictypes.h"
12 13
13 namespace base { 14 namespace base {
14 15
15 class BASE_EXPORT HistogramBase { 16 class BASE_EXPORT HistogramBase {
16 public: 17 public:
17 typedef int Sample; // Used for samples. 18 typedef int Sample; // Used for samples.
18 typedef int Count; // Used to count samples. 19 typedef int Count; // Used to count samples.
19 20
20 static const Sample kSampleType_MAX; // INT_MAX 21 static const Sample kSampleType_MAX; // INT_MAX
21 22
23 enum Flags {
24 kNoFlags = 0,
25 kUmaTargetedHistogramFlag = 0x1, // Histogram should be UMA uploaded.
26
27 // Indicate that the histogram was pickled to be sent across an IPC Channel.
28 // If we observe this flag on a histogram being aggregated into after IPC,
29 // then we are running in a single process mode, and the aggregation should
30 // not take place (as we would be aggregating back into the source
31 // histogram!).
32 kIPCSerializationSourceFlag = 0x10,
33
34 // Only for Histogram and its sub classes: fancy bucket-naming support.
Ilya Sherman 2012/08/04 01:18:35 nit: It doesn't seem appropriate for HistogramBase
kaiwang 2012/08/08 03:59:33 agree... Let's keep this for code compatibility fo
35 kHexRangePrintingFlag = 0x8000,
36 };
37
38
22 HistogramBase(const std::string& name); 39 HistogramBase(const std::string& name);
23 virtual ~HistogramBase(); 40 virtual ~HistogramBase();
24 41
25 std::string histogram_name() const { return histogram_name_; } 42 std::string histogram_name() const { return histogram_name_; }
26 43
44 // Operations with Flags enum.
45 void SetFlags(int32 flags) { flags_ |= flags; }
46 void ClearFlags(int32 flags) { flags_ &= ~flags; }
Ilya Sherman 2012/08/04 01:18:35 nit: Please either write the function names in hac
kaiwang 2012/08/08 03:59:33 Will move to .cc file, so it will not affect other
47 int32 flags() const { return flags_; }
48
27 virtual void Add(Sample value) = 0; 49 virtual void Add(Sample value) = 0;
28 50
29 // The following methods provide graphical histogram displays. 51 // The following methods provide graphical histogram displays.
30 virtual void WriteHTMLGraph(std::string* output) const = 0; 52 virtual void WriteHTMLGraph(std::string* output) const = 0;
31 virtual void WriteAscii(std::string* output) const = 0; 53 virtual void WriteAscii(std::string* output) const = 0;
32 54
33 private: 55 private:
34 const std::string histogram_name_; 56 const std::string histogram_name_;
57 int32 flags_;
35 }; 58 };
36 59
37 } // namespace base 60 } // namespace base
38 61
39 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 62 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698