| 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 "allocation.h" | 9 #include "allocation.h" |
| 10 #include "objects.h" | 10 #include "objects.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 explicit HistogramTimerScope(HistogramTimer* timer, | 258 explicit HistogramTimerScope(HistogramTimer* timer, |
| 259 bool allow_nesting = false) | 259 bool allow_nesting = false) |
| 260 #ifdef DEBUG | 260 #ifdef DEBUG |
| 261 : timer_(timer), | 261 : timer_(timer), |
| 262 skipped_timer_start_(false) { | 262 skipped_timer_start_(false) { |
| 263 if (timer_->timer()->IsStarted() && allow_nesting) { | 263 if (timer_->timer()->IsStarted() && allow_nesting) { |
| 264 skipped_timer_start_ = true; | 264 skipped_timer_start_ = true; |
| 265 } else { | 265 } else { |
| 266 timer_->Start(); | 266 timer_->Start(); |
| 267 } | 267 } |
| 268 } |
| 268 #else | 269 #else |
| 269 : timer_(timer) { | 270 : timer_(timer) { |
| 270 timer_->Start(); | 271 timer_->Start(); |
| 272 } |
| 271 #endif | 273 #endif |
| 272 } | |
| 273 ~HistogramTimerScope() { | 274 ~HistogramTimerScope() { |
| 274 #ifdef DEBUG | 275 #ifdef DEBUG |
| 275 if (!skipped_timer_start_) { | 276 if (!skipped_timer_start_) { |
| 276 timer_->Stop(); | 277 timer_->Stop(); |
| 277 } | 278 } |
| 278 #else | 279 #else |
| 279 timer_->Stop(); | 280 timer_->Stop(); |
| 280 #endif | 281 #endif |
| 281 } | 282 } |
| 283 |
| 282 private: | 284 private: |
| 283 HistogramTimer* timer_; | 285 HistogramTimer* timer_; |
| 284 #ifdef DEBUG | 286 #ifdef DEBUG |
| 285 bool skipped_timer_start_; | 287 bool skipped_timer_start_; |
| 286 #endif | 288 #endif |
| 287 }; | 289 }; |
| 288 | 290 |
| 289 | 291 |
| 290 #define HISTOGRAM_TIMER_LIST(HT) \ | 292 #define HISTOGRAM_TIMER_LIST(HT) \ |
| 291 /* Garbage collection timers. */ \ | 293 /* Garbage collection timers. */ \ |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 friend class Isolate; | 679 friend class Isolate; |
| 678 | 680 |
| 679 explicit Counters(Isolate* isolate); | 681 explicit Counters(Isolate* isolate); |
| 680 | 682 |
| 681 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 683 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
| 682 }; | 684 }; |
| 683 | 685 |
| 684 } } // namespace v8::internal | 686 } } // namespace v8::internal |
| 685 | 687 |
| 686 #endif // V8_COUNTERS_H_ | 688 #endif // V8_COUNTERS_H_ |
| OLD | NEW |