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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // static | 309 // static |
310 void RuntimeCallStats::CorrectCurrentCounterId(RuntimeCallStats* stats, | 310 void RuntimeCallStats::CorrectCurrentCounterId(RuntimeCallStats* stats, |
311 CounterId counter_id) { | 311 CounterId counter_id) { |
312 DCHECK_NOT_NULL(stats->current_timer_); | 312 DCHECK_NOT_NULL(stats->current_timer_); |
313 RuntimeCallCounter* counter = &(stats->*counter_id); | 313 RuntimeCallCounter* counter = &(stats->*counter_id); |
314 stats->current_timer_->counter_ = counter; | 314 stats->current_timer_->counter_ = counter; |
315 } | 315 } |
316 | 316 |
317 void RuntimeCallStats::Print(std::ostream& os) { | 317 void RuntimeCallStats::Print(std::ostream& os) { |
318 RuntimeCallStatEntries entries; | 318 RuntimeCallStatEntries entries; |
| 319 if (current_timer_ != NULL) { |
| 320 current_timer_->Elapsed(); |
| 321 } |
319 | 322 |
320 #define PRINT_COUNTER(name) entries.Add(&this->name); | 323 #define PRINT_COUNTER(name) entries.Add(&this->name); |
321 FOR_EACH_MANUAL_COUNTER(PRINT_COUNTER) | 324 FOR_EACH_MANUAL_COUNTER(PRINT_COUNTER) |
322 #undef PRINT_COUNTER | 325 #undef PRINT_COUNTER |
323 | 326 |
324 #define PRINT_COUNTER(name, nargs, ressize) entries.Add(&this->Runtime_##name); | 327 #define PRINT_COUNTER(name, nargs, ressize) entries.Add(&this->Runtime_##name); |
325 FOR_EACH_INTRINSIC(PRINT_COUNTER) | 328 FOR_EACH_INTRINSIC(PRINT_COUNTER) |
326 #undef PRINT_COUNTER | 329 #undef PRINT_COUNTER |
327 | 330 |
328 #define PRINT_COUNTER(name) entries.Add(&this->Builtin_##name); | 331 #define PRINT_COUNTER(name) entries.Add(&this->Builtin_##name); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 #undef RESET_COUNTER | 364 #undef RESET_COUNTER |
362 | 365 |
363 #define RESET_COUNTER(name) this->Handler_##name.Reset(); | 366 #define RESET_COUNTER(name) this->Handler_##name.Reset(); |
364 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) | 367 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) |
365 #undef RESET_COUNTER | 368 #undef RESET_COUNTER |
366 | 369 |
367 in_use_ = true; | 370 in_use_ = true; |
368 } | 371 } |
369 | 372 |
370 void RuntimeCallStats::Dump(v8::tracing::TracedValue* value) { | 373 void RuntimeCallStats::Dump(v8::tracing::TracedValue* value) { |
| 374 if (current_timer_ != NULL) { |
| 375 current_timer_->Elapsed(); |
| 376 } |
371 #define DUMP_COUNTER(name) \ | 377 #define DUMP_COUNTER(name) \ |
372 if (this->name.count > 0) this->name.Dump(value); | 378 if (this->name.count > 0) this->name.Dump(value); |
373 FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER) | 379 FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER) |
374 #undef DUMP_COUNTER | 380 #undef DUMP_COUNTER |
375 | 381 |
376 #define DUMP_COUNTER(name, nargs, result_size) \ | 382 #define DUMP_COUNTER(name, nargs, result_size) \ |
377 if (this->Runtime_##name.count > 0) this->Runtime_##name.Dump(value); | 383 if (this->Runtime_##name.count > 0) this->Runtime_##name.Dump(value); |
378 FOR_EACH_INTRINSIC(DUMP_COUNTER) | 384 FOR_EACH_INTRINSIC(DUMP_COUNTER) |
379 #undef DUMP_COUNTER | 385 #undef DUMP_COUNTER |
380 | 386 |
(...skipping 10 matching lines...) Expand all Loading... |
391 #define DUMP_COUNTER(name) \ | 397 #define DUMP_COUNTER(name) \ |
392 if (this->Handler_##name.count > 0) this->Handler_##name.Dump(value); | 398 if (this->Handler_##name.count > 0) this->Handler_##name.Dump(value); |
393 FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER) | 399 FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER) |
394 #undef DUMP_COUNTER | 400 #undef DUMP_COUNTER |
395 | 401 |
396 in_use_ = false; | 402 in_use_ = false; |
397 } | 403 } |
398 | 404 |
399 } // namespace internal | 405 } // namespace internal |
400 } // namespace v8 | 406 } // namespace v8 |
OLD | NEW |