| 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 #include "src/counters.h" | 5 #include "src/counters.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 stats->current_timer_ = timer; | 281 stats->current_timer_ = timer; |
| 282 } | 282 } |
| 283 | 283 |
| 284 // static | 284 // static |
| 285 void RuntimeCallStats::Leave(Isolate* isolate, RuntimeCallTimer* timer) { | 285 void RuntimeCallStats::Leave(Isolate* isolate, RuntimeCallTimer* timer) { |
| 286 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); | 286 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
| 287 DCHECK_EQ(stats->current_timer_, timer); | 287 DCHECK_EQ(stats->current_timer_, timer); |
| 288 stats->current_timer_ = timer->Stop(); | 288 stats->current_timer_ = timer->Stop(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // static |
| 292 void RuntimeCallStats::CorrectCurrentCounterId(Isolate* isolate, |
| 293 CounterId counter_id) { |
| 294 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
| 295 DCHECK_NOT_NULL(stats->current_timer_); |
| 296 RuntimeCallCounter* counter = &(stats->*counter_id); |
| 297 stats->current_timer_->counter_ = counter; |
| 298 } |
| 299 |
| 291 void RuntimeCallStats::Print(std::ostream& os) { | 300 void RuntimeCallStats::Print(std::ostream& os) { |
| 292 RuntimeCallStatEntries entries; | 301 RuntimeCallStatEntries entries; |
| 293 | 302 |
| 294 #define PRINT_COUNTER(name, nargs, ressize) entries.Add(&this->Runtime_##name); | 303 #define PRINT_COUNTER(name, nargs, ressize) entries.Add(&this->Runtime_##name); |
| 295 FOR_EACH_INTRINSIC(PRINT_COUNTER) | 304 FOR_EACH_INTRINSIC(PRINT_COUNTER) |
| 296 #undef PRINT_COUNTER | 305 #undef PRINT_COUNTER |
| 297 | 306 |
| 298 #define PRINT_COUNTER(name, type) entries.Add(&this->Builtin_##name); | 307 #define PRINT_COUNTER(name, type) entries.Add(&this->Builtin_##name); |
| 299 BUILTIN_LIST_C(PRINT_COUNTER) | 308 BUILTIN_LIST_C(PRINT_COUNTER) |
| 300 #undef PRINT_COUNTER | 309 #undef PRINT_COUNTER |
| 301 | 310 |
| 311 #define PRINT_COUNTER(name) entries.Add(&this->Handler_##name); |
| 312 FOR_EACH_HANDLER_COUNTER(PRINT_COUNTER) |
| 313 #undef PRINT_COUNTER |
| 314 |
| 302 entries.Add(&this->ExternalCallback); | 315 entries.Add(&this->ExternalCallback); |
| 303 entries.Add(&this->GC); | 316 entries.Add(&this->GC); |
| 304 entries.Add(&this->UnexpectedStubMiss); | 317 entries.Add(&this->UnexpectedStubMiss); |
| 305 | 318 |
| 306 entries.Print(os); | 319 entries.Print(os); |
| 307 } | 320 } |
| 308 | 321 |
| 309 void RuntimeCallStats::Reset() { | 322 void RuntimeCallStats::Reset() { |
| 310 if (!FLAG_runtime_call_stats) return; | 323 if (!FLAG_runtime_call_stats) return; |
| 311 #define RESET_COUNTER(name, nargs, ressize) this->Runtime_##name.Reset(); | 324 #define RESET_COUNTER(name, nargs, ressize) this->Runtime_##name.Reset(); |
| 312 FOR_EACH_INTRINSIC(RESET_COUNTER) | 325 FOR_EACH_INTRINSIC(RESET_COUNTER) |
| 313 #undef RESET_COUNTER | 326 #undef RESET_COUNTER |
| 314 #define RESET_COUNTER(name, type) this->Builtin_##name.Reset(); | 327 #define RESET_COUNTER(name, type) this->Builtin_##name.Reset(); |
| 315 BUILTIN_LIST_C(RESET_COUNTER) | 328 BUILTIN_LIST_C(RESET_COUNTER) |
| 316 #undef RESET_COUNTER | 329 #undef RESET_COUNTER |
| 317 this->ExternalCallback.Reset(); | 330 this->ExternalCallback.Reset(); |
| 318 this->GC.Reset(); | 331 this->GC.Reset(); |
| 319 this->UnexpectedStubMiss.Reset(); | 332 this->UnexpectedStubMiss.Reset(); |
| 320 } | 333 } |
| 321 | 334 |
| 322 } // namespace internal | 335 } // namespace internal |
| 323 } // namespace v8 | 336 } // namespace v8 |
| OLD | NEW |