Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 HistogramBase(const std::string& name); | 44 HistogramBase(const std::string& name); |
| 45 virtual ~HistogramBase(); | 45 virtual ~HistogramBase(); |
| 46 | 46 |
| 47 std::string histogram_name() const { return histogram_name_; } | 47 std::string histogram_name() const { return histogram_name_; } |
| 48 | 48 |
| 49 // Operations with Flags enum. | 49 // Operations with Flags enum. |
| 50 int32 flags() const { return flags_; } | 50 int32 flags() const { return flags_; } |
| 51 void SetFlags(int32 flags); | 51 void SetFlags(int32 flags); |
| 52 void ClearFlags(int32 flags); | 52 void ClearFlags(int32 flags); |
| 53 | 53 |
| 54 virtual bool HasConstructionArguments(Sample minimum, | |
|
Ilya Sherman
2012/10/24 00:30:08
nit: Please add a comment describing this method.
kaiwang
2012/10/24 03:43:28
Done.
| |
| 55 Sample maximum, | |
| 56 size_t bucket_count) const = 0; | |
| 57 | |
| 54 virtual void Add(Sample value) = 0; | 58 virtual void Add(Sample value) = 0; |
| 55 | 59 |
| 60 // Snapshot the current complete set of sample data. | |
| 61 // Override with atomic/locked snapshot if needed. | |
| 56 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0; | 62 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0; |
| 57 | 63 |
| 58 // The following methods provide graphical histogram displays. | 64 // The following methods provide graphical histogram displays. |
| 59 virtual void WriteHTMLGraph(std::string* output) const = 0; | 65 virtual void WriteHTMLGraph(std::string* output) const = 0; |
| 60 virtual void WriteAscii(std::string* output) const = 0; | 66 virtual void WriteAscii(std::string* output) const = 0; |
| 61 | 67 |
| 62 // Produce a JSON representation of the histogram. This is implemented with | 68 // Produce a JSON representation of the histogram. This is implemented with |
| 63 // the help of GetParameters and GetCountAndBucketData; overwrite them to | 69 // the help of GetParameters and GetCountAndBucketData; overwrite them to |
| 64 // customize the output. | 70 // customize the output. |
| 65 void WriteJSON(std::string* output) const; | 71 void WriteJSON(std::string* output) const; |
| 66 | 72 |
| 67 protected: | 73 protected: |
| 68 // Writes information about the construction parameters in |params|. | 74 // Writes information about the construction parameters in |params|. |
| 69 virtual void GetParameters(DictionaryValue* params) const = 0; | 75 virtual void GetParameters(DictionaryValue* params) const = 0; |
| 70 | 76 |
| 71 // Writes information about the current (non-empty) buckets and their sample | 77 // Writes information about the current (non-empty) buckets and their sample |
| 72 // counts to |buckets| and the total sample count to |count|. | 78 // counts to |buckets| and the total sample count to |count|. |
| 73 virtual void GetCountAndBucketData(Count* count, | 79 virtual void GetCountAndBucketData(Count* count, |
| 74 ListValue* buckets) const = 0; | 80 ListValue* buckets) const = 0; |
| 75 private: | 81 private: |
| 76 const std::string histogram_name_; | 82 const std::string histogram_name_; |
| 77 int32 flags_; | 83 int32 flags_; |
| 78 | 84 |
| 79 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 85 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
| 80 }; | 86 }; |
| 81 | 87 |
| 82 } // namespace base | 88 } // namespace base |
| 83 | 89 |
| 84 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 90 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
| OLD | NEW |