OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <stddef.h> |
| 6 #include <string> |
| 7 |
5 #include "base/metrics/stats_counters.h" | 8 #include "base/metrics/stats_counters.h" |
| 9 #include "base/metrics/stats_table.h" |
| 10 #include "base/time.h" |
6 | 11 |
7 namespace base { | 12 namespace base { |
8 | 13 |
9 StatsCounter::StatsCounter(const std::string& name) | 14 StatsCounter::StatsCounter(const std::string& name) |
10 : counter_id_(-1) { | 15 : counter_id_(-1) { |
11 // We prepend the name with 'c:' to indicate that it is a counter. | 16 // We prepend the name with 'c:' to indicate that it is a counter. |
12 name_ = "c:"; | 17 name_ = "c:"; |
13 name_.append(name); | 18 name_.append(name); |
14 } | 19 } |
15 | 20 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 113 } |
109 | 114 |
110 void StatsRate::Add(int value) { | 115 void StatsRate::Add(int value) { |
111 counter_.Increment(); | 116 counter_.Increment(); |
112 StatsCounterTimer::Add(value); | 117 StatsCounterTimer::Add(value); |
113 if (value > largest_add_.value()) | 118 if (value > largest_add_.value()) |
114 largest_add_.Set(value); | 119 largest_add_.Set(value); |
115 } | 120 } |
116 | 121 |
117 } // namespace base | 122 } // namespace base |
OLD | NEW |