| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_STATS_COUNTERS_H_ | 5 #ifndef BASE_METRICS_STATS_COUNTERS_H_ |
| 6 #define BASE_METRICS_STATS_COUNTERS_H_ | 6 #define BASE_METRICS_STATS_COUNTERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 // A StatsRate is a timer that keeps a count of the number of intervals added so | 158 // A StatsRate is a timer that keeps a count of the number of intervals added so |
| 159 // that several statistics can be produced: | 159 // that several statistics can be produced: |
| 160 // min, max, avg, count, total | 160 // min, max, avg, count, total |
| 161 class BASE_EXPORT StatsRate : public StatsCounterTimer { | 161 class BASE_EXPORT StatsRate : public StatsCounterTimer { |
| 162 public: | 162 public: |
| 163 // Constructs and starts the timer. | 163 // Constructs and starts the timer. |
| 164 explicit StatsRate(const std::string& name); | 164 explicit StatsRate(const std::string& name); |
| 165 virtual ~StatsRate(); | 165 virtual ~StatsRate(); |
| 166 | 166 |
| 167 virtual void Add(int value) OVERRIDE; | 167 void Add(int value) override; |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 StatsCounter counter_; | 170 StatsCounter counter_; |
| 171 StatsCounter largest_add_; | 171 StatsCounter largest_add_; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 | 174 |
| 175 // Helper class for scoping a timer or rate. | 175 // Helper class for scoping a timer or rate. |
| 176 template<class T> class StatsScope { | 176 template<class T> class StatsScope { |
| 177 public: | 177 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 188 timer_.Stop(); | 188 timer_.Stop(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 private: | 191 private: |
| 192 T& timer_; | 192 T& timer_; |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 } // namespace base | 195 } // namespace base |
| 196 | 196 |
| 197 #endif // BASE_METRICS_STATS_COUNTERS_H_ | 197 #endif // BASE_METRICS_STATS_COUNTERS_H_ |
| OLD | NEW |