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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_base.cc » ('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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 class HistogramSamples; 24 class HistogramSamples;
25 class ListValue; 25 class ListValue;
26 class Pickle; 26 class Pickle;
27 class PickleIterator; 27 class PickleIterator;
28 28
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 // These enums are used to facilitate deserialization of histograms from other 30 // These enums are used to facilitate deserialization of histograms from other
31 // processes into the browser. If you create another class that inherits from 31 // processes into the browser. If you create another class that inherits from
32 // HistogramBase, add new histogram types and names below. 32 // HistogramBase, add new histogram types and names below.
33 33
34 enum BASE_EXPORT HistogramType { 34 enum HistogramType {
35 HISTOGRAM, 35 HISTOGRAM,
36 LINEAR_HISTOGRAM, 36 LINEAR_HISTOGRAM,
37 BOOLEAN_HISTOGRAM, 37 BOOLEAN_HISTOGRAM,
38 CUSTOM_HISTOGRAM, 38 CUSTOM_HISTOGRAM,
39 SPARSE_HISTOGRAM, 39 SPARSE_HISTOGRAM,
40 }; 40 };
41 41
42 std::string HistogramTypeToString(HistogramType type); 42 std::string HistogramTypeToString(HistogramType type);
43 43
44 // Create or find existing histogram that matches the pickled info. 44 // Create or find existing histogram that matches the pickled info.
(...skipping 22 matching lines...) Expand all
67 // refer to |MetricsService::PrepareInitialStabilityLog|. 67 // refer to |MetricsService::PrepareInitialStabilityLog|.
68 kUmaStabilityHistogramFlag = kUmaTargetedHistogramFlag | 0x2, 68 kUmaStabilityHistogramFlag = kUmaTargetedHistogramFlag | 0x2,
69 69
70 // Indicates that the histogram was pickled to be sent across an IPC 70 // Indicates that the histogram was pickled to be sent across an IPC
71 // Channel. If we observe this flag on a histogram being aggregated into 71 // Channel. If we observe this flag on a histogram being aggregated into
72 // after IPC, then we are running in a single process mode, and the 72 // after IPC, then we are running in a single process mode, and the
73 // aggregation should not take place (as we would be aggregating back into 73 // aggregation should not take place (as we would be aggregating back into
74 // the source histogram!). 74 // the source histogram!).
75 kIPCSerializationSourceFlag = 0x10, 75 kIPCSerializationSourceFlag = 0x10,
76 76
77 // Indicates that a callback exists for when a new sample is recorded on
78 // this histogram. We store this as a flag with the histogram since
79 // histograms can be in performance critical code, and this allows us
80 // to shortcut looking up the callback if it doesn't exist.
81 kCallbackExists = 0x20,
82
77 // Only for Histogram and its sub classes: fancy bucket-naming support. 83 // Only for Histogram and its sub classes: fancy bucket-naming support.
78 kHexRangePrintingFlag = 0x8000, 84 kHexRangePrintingFlag = 0x8000,
79 }; 85 };
80 86
81 // Histogram data inconsistency types. 87 // Histogram data inconsistency types.
82 enum Inconsistency { 88 enum Inconsistency {
83 NO_INCONSISTENCIES = 0x0, 89 NO_INCONSISTENCIES = 0x0,
84 RANGE_CHECKSUM_ERROR = 0x1, 90 RANGE_CHECKSUM_ERROR = 0x1,
85 BUCKET_ORDER_ERROR = 0x2, 91 BUCKET_ORDER_ERROR = 0x2,
86 COUNT_HIGH_ERROR = 0x4, 92 COUNT_HIGH_ERROR = 0x4,
87 COUNT_LOW_ERROR = 0x8, 93 COUNT_LOW_ERROR = 0x8,
88 94
89 NEVER_EXCEEDED_VALUE = 0x10 95 NEVER_EXCEEDED_VALUE = 0x10
90 }; 96 };
91 97
92 explicit HistogramBase(const std::string& name); 98 explicit HistogramBase(const std::string& name);
93 virtual ~HistogramBase(); 99 virtual ~HistogramBase();
94 100
95 std::string histogram_name() const { return histogram_name_; } 101 const std::string& histogram_name() const { return histogram_name_; }
96 102
97 // Comapres |name| to the histogram name and triggers a DCHECK if they do not 103 // Comapres |name| to the histogram name and triggers a DCHECK if they do not
98 // match. This is a helper function used by histogram macros, which results in 104 // match. This is a helper function used by histogram macros, which results in
99 // in more compact machine code being generated by the macros. 105 // in more compact machine code being generated by the macros.
100 void CheckName(const StringPiece& name) const; 106 void CheckName(const StringPiece& name) const;
101 107
102 // Operations with Flags enum. 108 // Operations with Flags enum.
103 int32_t flags() const { return flags_; } 109 int32_t flags() const { return flags_; }
104 void SetFlags(int32_t flags); 110 void SetFlags(int32_t flags);
105 void ClearFlags(int32_t flags); 111 void ClearFlags(int32_t flags);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 171
166 // Return a string description of what goes in a given bucket. 172 // Return a string description of what goes in a given bucket.
167 const std::string GetSimpleAsciiBucketRange(Sample sample) const; 173 const std::string GetSimpleAsciiBucketRange(Sample sample) const;
168 174
169 // Write textual description of the bucket contents (relative to histogram). 175 // Write textual description of the bucket contents (relative to histogram).
170 // Output is the count in the buckets, as well as the percentage. 176 // Output is the count in the buckets, as well as the percentage.
171 void WriteAsciiBucketValue(Count current, 177 void WriteAsciiBucketValue(Count current,
172 double scaled_sum, 178 double scaled_sum,
173 std::string* output) const; 179 std::string* output) const;
174 180
181 // Retrieves the callback for this histogram, if one exists, and runs it
182 // passing |sample| as the parameter.
183 void FindAndRunCallback(Sample sample) const;
184
175 private: 185 private:
176 const std::string histogram_name_; 186 const std::string histogram_name_;
177 int32_t flags_; 187 int32_t flags_;
178 188
179 DISALLOW_COPY_AND_ASSIGN(HistogramBase); 189 DISALLOW_COPY_AND_ASSIGN(HistogramBase);
180 }; 190 };
181 191
182 } // namespace base 192 } // namespace base
183 193
184 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 194 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698