| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/timer.h" | 5 #include "vm/timer.h" |
| 6 | 6 |
| 7 namespace dart { | 7 namespace dart { |
| 8 | 8 |
| 9 // Define timer command line flags. | 9 // Define timer command line flags. |
| 10 #define DEFINE_TIMER_FLAG(name, msg) \ | 10 #define DEFINE_TIMER_FLAG(name, msg) \ |
| 11 DEFINE_FLAG(bool, name, false, ""#name); | 11 DEFINE_FLAG(bool, name, false, ""#name); |
| 12 TIMER_LIST(DEFINE_TIMER_FLAG) | 12 TIMER_LIST(DEFINE_TIMER_FLAG) |
| 13 #undef DEFINE_TIMER_FLAG | 13 #undef DEFINE_TIMER_FLAG |
| 14 DEFINE_FLAG(bool, time_all, false, "Time all functionality"); | 14 DEFINE_FLAG(bool, time_all, false, "Time all functionality"); |
| 15 | 15 |
| 16 | 16 |
| 17 // Maintains a list of timers per isolate. | 17 // Maintains a list of timers per isolate. |
| 18 #define INIT_TIMERS(name, msg) \ | 18 #define INIT_TIMERS(name, msg) \ |
| 19 name##_((FLAG_##name || FLAG_time_all), msg), | 19 name##_((FLAG_##name || FLAG_time_all), msg), |
| 20 TimerList::TimerList() | 20 TimerList::TimerList() |
| 21 : TIMER_LIST(INIT_TIMERS) | 21 : TIMER_LIST(INIT_TIMERS) |
| 22 padding_(false) { | 22 padding_(false) { |
| 23 } | 23 } |
| 24 #undef INIT_TIMERS | 24 #undef INIT_TIMERS |
| 25 | 25 |
| 26 | 26 |
| 27 #define TIMER_FIELD_REPORT(name, msg) \ | 27 #define TIMER_FIELD_REPORT(name, msg) \ |
| 28 if (name().enabled() && name().message() != NULL) { \ | 28 if (name().enabled() && name().message() != NULL) { \ |
| 29 OS::Print("%s %ld micros.\n", name().message(), name().TotalElapsedTime());\ | 29 OS::Print("%s %"Pd64" micros.\n", \ |
| 30 name().message(), \ |
| 31 name().TotalElapsedTime()); \ |
| 30 } | 32 } |
| 31 void TimerList::ReportTimers() { | 33 void TimerList::ReportTimers() { |
| 32 TIMER_LIST(TIMER_FIELD_REPORT); | 34 TIMER_LIST(TIMER_FIELD_REPORT); |
| 33 } | 35 } |
| 34 #undef TIMER_FIELD_REPORT | 36 #undef TIMER_FIELD_REPORT |
| 35 | 37 |
| 36 } // namespace dart | 38 } // namespace dart |
| OLD | NEW |