OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 V8_COUNTERS_H_ | 5 #ifndef V8_COUNTERS_H_ |
6 #define V8_COUNTERS_H_ | 6 #define V8_COUNTERS_H_ |
7 | 7 |
8 #include "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
| 10 #include "src/base/platform/elapsed-timer.h" |
10 #include "src/globals.h" | 11 #include "src/globals.h" |
11 #include "src/objects.h" | 12 #include "src/objects.h" |
12 #include "src/platform/elapsed-timer.h" | |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // StatsCounters is an interface for plugging into external | 17 // StatsCounters is an interface for plugging into external |
18 // counters for monitoring. Counters can be looked up and | 18 // counters for monitoring. Counters can be looked up and |
19 // manipulated by name. | 19 // manipulated by name. |
20 | 20 |
21 class StatsTable { | 21 class StatsTable { |
22 public: | 22 public: |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Stop the timer and record the results. | 234 // Stop the timer and record the results. |
235 void Stop(); | 235 void Stop(); |
236 | 236 |
237 // Returns true if the timer is running. | 237 // Returns true if the timer is running. |
238 bool Running() { | 238 bool Running() { |
239 return Enabled() && timer_.IsStarted(); | 239 return Enabled() && timer_.IsStarted(); |
240 } | 240 } |
241 | 241 |
242 // TODO(bmeurer): Remove this when HistogramTimerScope is fixed. | 242 // TODO(bmeurer): Remove this when HistogramTimerScope is fixed. |
243 #ifdef DEBUG | 243 #ifdef DEBUG |
244 ElapsedTimer* timer() { return &timer_; } | 244 base::ElapsedTimer* timer() { return &timer_; } |
245 #endif | 245 #endif |
246 | 246 |
247 private: | 247 private: |
248 ElapsedTimer timer_; | 248 base::ElapsedTimer timer_; |
249 }; | 249 }; |
250 | 250 |
251 // Helper class for scoping a HistogramTimer. | 251 // Helper class for scoping a HistogramTimer. |
252 // TODO(bmeurer): The ifdeffery is an ugly hack around the fact that the | 252 // TODO(bmeurer): The ifdeffery is an ugly hack around the fact that the |
253 // Parser is currently reentrant (when it throws an error, we call back | 253 // Parser is currently reentrant (when it throws an error, we call back |
254 // into JavaScript and all bets are off), but ElapsedTimer is not | 254 // into JavaScript and all bets are off), but ElapsedTimer is not |
255 // reentry-safe. Fix this properly and remove |allow_nesting|. | 255 // reentry-safe. Fix this properly and remove |allow_nesting|. |
256 class HistogramTimerScope BASE_EMBEDDED { | 256 class HistogramTimerScope BASE_EMBEDDED { |
257 public: | 257 public: |
258 explicit HistogramTimerScope(HistogramTimer* timer, | 258 explicit HistogramTimerScope(HistogramTimer* timer, |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 friend class Isolate; | 680 friend class Isolate; |
681 | 681 |
682 explicit Counters(Isolate* isolate); | 682 explicit Counters(Isolate* isolate); |
683 | 683 |
684 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 684 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
685 }; | 685 }; |
686 | 686 |
687 } } // namespace v8::internal | 687 } } // namespace v8::internal |
688 | 688 |
689 #endif // V8_COUNTERS_H_ | 689 #endif // V8_COUNTERS_H_ |
OLD | NEW |