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 | |
71 | |
72 // Used to aggregate stats. Must be atomic. | 68 // Used to aggregate stats. Must be atomic. |
73 void CompilerStats::Add(const CompilerStats& other) { | 69 void CompilerStats::Add(const CompilerStats& other) { |
74 #define ADD_TOTAL(timer_name, literal) \ | 70 #define ADD_TOTAL(timer_name, literal) \ |
75 timer_name.AddTotal(other.timer_name); | 71 timer_name.AddTotal(other.timer_name); |
76 | 72 |
77 STAT_TIMERS(ADD_TOTAL) | 73 STAT_TIMERS(ADD_TOTAL) |
78 #undef ADD_TOTAL | 74 #undef ADD_TOTAL |
79 | 75 |
80 #define ADD_COUNTER(counter_name) \ | 76 #define ADD_COUNTER(counter_name) \ |
81 AtomicOperations::IncrementInt64By(&counter_name, other.counter_name); | 77 AtomicOperations::IncrementInt64By(&counter_name, other.counter_name); |
(...skipping 27 matching lines...) Expand all Loading... |
109 | 105 |
110 #define CHECK_COUNTERS(counter_name) \ | 106 #define CHECK_COUNTERS(counter_name) \ |
111 if (counter_name != 0) return false; | 107 if (counter_name != 0) return false; |
112 | 108 |
113 STAT_COUNTERS(CHECK_COUNTERS) | 109 STAT_COUNTERS(CHECK_COUNTERS) |
114 #undef CHECK_COUNTERS | 110 #undef CHECK_COUNTERS |
115 return true; | 111 return true; |
116 } | 112 } |
117 | 113 |
118 | 114 |
| 115 #ifndef PRODUCT |
| 116 |
| 117 |
119 // 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 |
120 // 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 |
121 // the accumulated text when all of the compiler stats values are | 120 // the accumulated text when all of the compiler stats values are |
122 // added to the log. | 121 // added to the log. |
123 static void PrintToStats(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); | 122 static void PrintToStats(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); |
124 static void PrintToStats(const char* format, ...) { | 123 static void PrintToStats(const char* format, ...) { |
125 Thread* thread = Thread::Current(); | 124 Thread* thread = Thread::Current(); |
126 Isolate* isolate = thread->isolate(); | 125 Isolate* isolate = thread->isolate(); |
127 CompilerStats* stats = isolate->aggregate_compiler_stats(); | 126 CompilerStats* stats = isolate->aggregate_compiler_stats(); |
128 Zone* zone = thread->zone(); | 127 Zone* zone = thread->zone(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); | 308 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); |
310 log.Flush(); | 309 log.Flush(); |
311 char* stats_text = text; | 310 char* stats_text = text; |
312 text = NULL; | 311 text = NULL; |
313 return stats_text; | 312 return stats_text; |
314 } | 313 } |
315 | 314 |
316 #endif // !PRODUCT | 315 #endif // !PRODUCT |
317 | 316 |
318 } // namespace dart | 317 } // namespace dart |
OLD | NEW |