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 Histogram_h | 5 #ifndef Histogram_h |
6 #define Histogram_h | 6 #define Histogram_h |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class PLATFORM_EXPORT SparseHistogram { | 47 class PLATFORM_EXPORT SparseHistogram { |
48 public: | 48 public: |
49 explicit SparseHistogram(const char* name); | 49 explicit SparseHistogram(const char* name); |
50 | 50 |
51 void Sample(base::HistogramBase::Sample); | 51 void Sample(base::HistogramBase::Sample); |
52 | 52 |
53 private: | 53 private: |
54 base::HistogramBase* histogram_; | 54 base::HistogramBase* histogram_; |
55 }; | 55 }; |
56 | 56 |
| 57 class PLATFORM_EXPORT LinearHistogram : public CustomCountHistogram { |
| 58 public: |
| 59 explicit LinearHistogram(const char* name, |
| 60 base::HistogramBase::Sample min, |
| 61 base::HistogramBase::Sample max, |
| 62 int32_t bucket_count); |
| 63 }; |
| 64 |
57 class PLATFORM_EXPORT ScopedUsHistogramTimer { | 65 class PLATFORM_EXPORT ScopedUsHistogramTimer { |
58 public: | 66 public: |
59 ScopedUsHistogramTimer(CustomCountHistogram& counter) | 67 ScopedUsHistogramTimer(CustomCountHistogram& counter) |
60 : start_time_(WTF::MonotonicallyIncreasingTime()), counter_(counter) {} | 68 : start_time_(WTF::MonotonicallyIncreasingTime()), counter_(counter) {} |
61 | 69 |
62 ~ScopedUsHistogramTimer() { | 70 ~ScopedUsHistogramTimer() { |
63 counter_.Count((WTF::MonotonicallyIncreasingTime() - start_time_) * | 71 counter_.Count((WTF::MonotonicallyIncreasingTime() - start_time_) * |
64 base::Time::kMicrosecondsPerSecond); | 72 base::Time::kMicrosecondsPerSecond); |
65 } | 73 } |
66 | 74 |
(...skipping 13 matching lines...) Expand all Loading... |
80 // This macro records all times between 0us and 10 seconds. | 88 // This macro records all times between 0us and 10 seconds. |
81 // Do not change this macro without renaming all metrics that use it! | 89 // Do not change this macro without renaming all metrics that use it! |
82 #define SCOPED_BLINK_UMA_HISTOGRAM_TIMER(name) \ | 90 #define SCOPED_BLINK_UMA_HISTOGRAM_TIMER(name) \ |
83 DEFINE_STATIC_LOCAL(CustomCountHistogram, scoped_us_counter, \ | 91 DEFINE_STATIC_LOCAL(CustomCountHistogram, scoped_us_counter, \ |
84 (name, 0, 10000000, 50)); \ | 92 (name, 0, 10000000, 50)); \ |
85 ScopedUsHistogramTimer timer(scoped_us_counter); | 93 ScopedUsHistogramTimer timer(scoped_us_counter); |
86 | 94 |
87 } // namespace blink | 95 } // namespace blink |
88 | 96 |
89 #endif // Histogram_h | 97 #endif // Histogram_h |
OLD | NEW |