OLD | NEW |
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 | 12 |
13 namespace base { | 13 namespace base { |
14 | 14 |
15 class BASE_EXPORT HistogramBase { | 15 class BASE_EXPORT HistogramBase { |
16 public: | 16 public: |
17 typedef int Sample; // Used for samples. | 17 typedef int Sample; // Used for samples. |
18 typedef int Count; // Used to count samples. | 18 typedef int Count; // Used to count samples. |
19 | 19 |
20 static const Sample kSampleType_MAX = INT_MAX; | 20 static const Sample kSampleType_MAX; // INT_MAX |
21 | 21 |
22 HistogramBase(const std::string& name); | 22 HistogramBase(const std::string& name); |
23 virtual ~HistogramBase(); | 23 virtual ~HistogramBase(); |
24 | 24 |
25 std::string histogram_name() const { return histogram_name_; } | 25 std::string histogram_name() const { return histogram_name_; } |
26 | 26 |
27 virtual void Add(Sample value) = 0; | 27 virtual void Add(Sample value) = 0; |
28 | 28 |
29 // The following methods provide graphical histogram displays. | 29 // The following methods provide graphical histogram displays. |
30 virtual void WriteHTMLGraph(std::string* output) const = 0; | 30 virtual void WriteHTMLGraph(std::string* output) const = 0; |
31 virtual void WriteAscii(std::string* output) const = 0; | 31 virtual void WriteAscii(std::string* output) const = 0; |
32 | 32 |
33 private: | 33 private: |
34 const std::string histogram_name_; | 34 const std::string histogram_name_; |
35 }; | 35 }; |
36 | 36 |
37 } // namespace base | 37 } // namespace base |
38 | 38 |
39 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 39 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |