| 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/compiler_stats.h" | 5 #include "vm/compiler_stats.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/log.h" | 8 #include "vm/log.h" |
| 9 #include "vm/object_graph.h" | 9 #include "vm/object_graph.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 #define INITIALIZE_COUNTERS(counter_name) \ | 59 #define INITIALIZE_COUNTERS(counter_name) \ |
| 60 counter_name(0), | 60 counter_name(0), |
| 61 STAT_COUNTERS(INITIALIZE_COUNTERS) | 61 STAT_COUNTERS(INITIALIZE_COUNTERS) |
| 62 #undef INITIALIZE_COUNTERS | 62 #undef INITIALIZE_COUNTERS |
| 63 text(NULL), | 63 text(NULL), |
| 64 use_benchmark_output(false) { | 64 use_benchmark_output(false) { |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 #ifndef PRODUCT |
| 69 |
| 70 |
| 68 // Used to aggregate stats. Must be atomic. | 71 // Used to aggregate stats. Must be atomic. |
| 69 void CompilerStats::Add(const CompilerStats& other) { | 72 void CompilerStats::Add(const CompilerStats& other) { |
| 70 #define ADD_TOTAL(timer_name, literal) \ | 73 #define ADD_TOTAL(timer_name, literal) \ |
| 71 timer_name.AddTotal(other.timer_name); | 74 timer_name.AddTotal(other.timer_name); |
| 72 | 75 |
| 73 STAT_TIMERS(ADD_TOTAL) | 76 STAT_TIMERS(ADD_TOTAL) |
| 74 #undef ADD_TOTAL | 77 #undef ADD_TOTAL |
| 75 | 78 |
| 76 #define ADD_COUNTER(counter_name) \ | 79 #define ADD_COUNTER(counter_name) \ |
| 77 AtomicOperations::IncrementInt64By(&counter_name, other.counter_name); | 80 AtomicOperations::IncrementInt64By(&counter_name, other.counter_name); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 105 | 108 |
| 106 #define CHECK_COUNTERS(counter_name) \ | 109 #define CHECK_COUNTERS(counter_name) \ |
| 107 if (counter_name != 0) return false; | 110 if (counter_name != 0) return false; |
| 108 | 111 |
| 109 STAT_COUNTERS(CHECK_COUNTERS) | 112 STAT_COUNTERS(CHECK_COUNTERS) |
| 110 #undef CHECK_COUNTERS | 113 #undef CHECK_COUNTERS |
| 111 return true; | 114 return true; |
| 112 } | 115 } |
| 113 | 116 |
| 114 | 117 |
| 115 #ifndef PRODUCT | |
| 116 | |
| 117 | |
| 118 // This function is used as a callback in the log object to which the | 118 // This function is used as a callback in the log object to which the |
| 119 // compiler stats are printed. It will be called only once, to print | 119 // compiler stats are printed. It will be called only once, to print |
| 120 // the accumulated text when all of the compiler stats values are | 120 // the accumulated text when all of the compiler stats values are |
| 121 // added to the log. | 121 // added to the log. |
| 122 static void PrintToStats(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); | 122 static void PrintToStats(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); |
| 123 static void PrintToStats(const char* format, ...) { | 123 static void PrintToStats(const char* format, ...) { |
| 124 Thread* thread = Thread::Current(); | 124 Thread* thread = Thread::Current(); |
| 125 Isolate* isolate = thread->isolate(); | 125 Isolate* isolate = thread->isolate(); |
| 126 CompilerStats* stats = isolate->aggregate_compiler_stats(); | 126 CompilerStats* stats = isolate->aggregate_compiler_stats(); |
| 127 Zone* zone = thread->zone(); | 127 Zone* zone = thread->zone(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); | 308 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); |
| 309 log.Flush(); | 309 log.Flush(); |
| 310 char* stats_text = text; | 310 char* stats_text = text; |
| 311 text = NULL; | 311 text = NULL; |
| 312 return stats_text; | 312 return stats_text; |
| 313 } | 313 } |
| 314 | 314 |
| 315 #endif // !PRODUCT | 315 #endif // !PRODUCT |
| 316 | 316 |
| 317 } // namespace dart | 317 } // namespace dart |
| OLD | NEW |