OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FUNCTIONS_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_FUNCTIONS_H_ |
6 #define BASE_METRICS_HISTOGRAM_FUNCTIONS_H_ | 6 #define BASE_METRICS_HISTOGRAM_FUNCTIONS_H_ |
7 | 7 |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 | 36 |
37 // For adding sample to enum histogram. | 37 // For adding sample to enum histogram. |
38 // Sample usage: | 38 // Sample usage: |
39 // base::UmaHistogramEnumeration("My.Enumeration", VALUE, EVENT_MAX_VALUE); | 39 // base::UmaHistogramEnumeration("My.Enumeration", VALUE, EVENT_MAX_VALUE); |
40 // Note that new Enum values can be added, but existing enums must never be | 40 // Note that new Enum values can be added, but existing enums must never be |
41 // renumbered or deleted and reused. | 41 // renumbered or deleted and reused. |
42 template <typename T> | 42 template <typename T> |
43 void UmaHistogramEnumeration(const std::string& name, T sample, T max) { | 43 void UmaHistogramEnumeration(const std::string& name, T sample, T max) { |
44 static_assert(std::is_enum<T>::value, | 44 static_assert(std::is_enum<T>::value, |
45 "Non enum passed to UmaHistogramEnumeration"); | 45 "Non enum passed to UmaHistogramEnumeration"); |
46 return UmaHistogramExactLinear(name, static_cast<int>(sample), max); | 46 return UmaHistogramExactLinear(name, static_cast<int>(sample), |
47 static_cast<int>(max)); | |
Ilya Sherman
2017/04/04 16:37:55
I'd prefer that you make this change in a separate
| |
47 } | 48 } |
48 | 49 |
49 // For adding boolean sample to histogram. | 50 // For adding boolean sample to histogram. |
50 // Sample usage: | 51 // Sample usage: |
51 // base::UmaHistogramBoolean("My.Boolean", true) | 52 // base::UmaHistogramBoolean("My.Boolean", true) |
52 BASE_EXPORT void UmaHistogramBoolean(const std::string& name, bool sample); | 53 BASE_EXPORT void UmaHistogramBoolean(const std::string& name, bool sample); |
53 | 54 |
54 // For adding histogram with percent. | 55 // For adding histogram with percent. |
55 // Percents are integer between 1 and 100. | 56 // Percents are integer between 1 and 100. |
56 // Sample usage: | 57 // Sample usage: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 92 |
92 // For recording memory related histograms. | 93 // For recording memory related histograms. |
93 // Used to measure common KB-granularity memory stats. Range is up to 500M. | 94 // Used to measure common KB-granularity memory stats. Range is up to 500M. |
94 BASE_EXPORT void UmaHistogramMemoryKB(const std::string& name, int sample); | 95 BASE_EXPORT void UmaHistogramMemoryKB(const std::string& name, int sample); |
95 // Used to measure common MB-granularity memory stats. Range is up to ~64G. | 96 // Used to measure common MB-granularity memory stats. Range is up to ~64G. |
96 BASE_EXPORT void UmaHistogramMemoryLargeMB(const std::string& name, int sample); | 97 BASE_EXPORT void UmaHistogramMemoryLargeMB(const std::string& name, int sample); |
97 | 98 |
98 } // namespace base | 99 } // namespace base |
99 | 100 |
100 #endif // BASE_METRICS_HISTOGRAM_FUNCTIONS_H_ | 101 #endif // BASE_METRICS_HISTOGRAM_FUNCTIONS_H_ |
OLD | NEW |