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

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

Issue 11231025: Histogram argument related change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missed namespace Created 8 years, 2 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 | « base/metrics/histogram.cc ('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 #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
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 // Whether the histogram has construction arguments as parameters specified.
55 // For histograms that don't have the concept of minimum, maximum or
56 // bucket_count, this function always returns false.
57 virtual bool HasConstructionArguments(Sample minimum,
58 Sample maximum,
59 size_t bucket_count) const = 0;
60
54 virtual void Add(Sample value) = 0; 61 virtual void Add(Sample value) = 0;
55 62
63 // Snapshot the current complete set of sample data.
64 // Override with atomic/locked snapshot if needed.
56 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0; 65 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0;
57 66
58 // The following methods provide graphical histogram displays. 67 // The following methods provide graphical histogram displays.
59 virtual void WriteHTMLGraph(std::string* output) const = 0; 68 virtual void WriteHTMLGraph(std::string* output) const = 0;
60 virtual void WriteAscii(std::string* output) const = 0; 69 virtual void WriteAscii(std::string* output) const = 0;
61 70
62 // Produce a JSON representation of the histogram. This is implemented with 71 // Produce a JSON representation of the histogram. This is implemented with
63 // the help of GetParameters and GetCountAndBucketData; overwrite them to 72 // the help of GetParameters and GetCountAndBucketData; overwrite them to
64 // customize the output. 73 // customize the output.
65 void WriteJSON(std::string* output) const; 74 void WriteJSON(std::string* output) const;
66 75
67 protected: 76 protected:
68 // Writes information about the construction parameters in |params|. 77 // Writes information about the construction parameters in |params|.
69 virtual void GetParameters(DictionaryValue* params) const = 0; 78 virtual void GetParameters(DictionaryValue* params) const = 0;
70 79
71 // Writes information about the current (non-empty) buckets and their sample 80 // Writes information about the current (non-empty) buckets and their sample
72 // counts to |buckets| and the total sample count to |count|. 81 // counts to |buckets| and the total sample count to |count|.
73 virtual void GetCountAndBucketData(Count* count, 82 virtual void GetCountAndBucketData(Count* count,
74 ListValue* buckets) const = 0; 83 ListValue* buckets) const = 0;
75 private: 84 private:
76 const std::string histogram_name_; 85 const std::string histogram_name_;
77 int32 flags_; 86 int32 flags_;
78 87
79 DISALLOW_COPY_AND_ASSIGN(HistogramBase); 88 DISALLOW_COPY_AND_ASSIGN(HistogramBase);
80 }; 89 };
81 90
82 } // namespace base 91 } // namespace base
83 92
84 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 93 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/sparse_histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698