| 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 #ifndef VM_COMPILER_STATS_H_ | 5 #ifndef VM_COMPILER_STATS_H_ |
| 6 #define VM_COMPILER_STATS_H_ | 6 #define VM_COMPILER_STATS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 bool use_benchmark_output; | 66 bool use_benchmark_output; |
| 67 | 67 |
| 68 // Update stats that are computed, e.g. token count. | 68 // Update stats that are computed, e.g. token count. |
| 69 void Update(); | 69 void Update(); |
| 70 | 70 |
| 71 void EnableBenchmark(); | 71 void EnableBenchmark(); |
| 72 char* BenchmarkOutput(); | 72 char* BenchmarkOutput(); |
| 73 char* PrintToZone(); | 73 char* PrintToZone(); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // TODO(hausner): make the increment thread-safe. | |
| 77 #define INC_STAT(thread, counter, incr) \ | 76 #define INC_STAT(thread, counter, incr) \ |
| 78 if (FLAG_compiler_stats) { \ | 77 if (FLAG_compiler_stats) { \ |
| 79 (thread)->isolate()->compiler_stats()->counter += (incr); } | 78 MutexLocker ml((thread)->isolate()->mutex()); \ |
| 79 (thread)->isolate()->compiler_stats()->counter += (incr); \ |
| 80 } |
| 80 | 81 |
| 81 #define STAT_VALUE(thread, counter) \ | 82 #define STAT_VALUE(thread, counter) \ |
| 82 ((FLAG_compiler_stats != false) ? \ | 83 ((FLAG_compiler_stats != false) ? \ |
| 83 (thread)->isolate()->compiler_stats()->counter : 0) | 84 (thread)->isolate()->compiler_stats()->counter : 0) |
| 84 | 85 |
| 85 #define CSTAT_TIMER_SCOPE(thr, t) \ | 86 #define CSTAT_TIMER_SCOPE(thr, t) \ |
| 86 TimerScope timer(FLAG_compiler_stats, \ | 87 TimerScope timer(FLAG_compiler_stats, \ |
| 87 FLAG_compiler_stats ? &((thr)->isolate()->compiler_stats()->t) : NULL, \ | 88 FLAG_compiler_stats ? &((thr)->isolate()->compiler_stats()->t) : NULL, \ |
| 88 thr); | 89 thr); |
| 89 | 90 |
| 90 } // namespace dart | 91 } // namespace dart |
| 91 | 92 |
| 92 #endif // VM_COMPILER_STATS_H_ | 93 #endif // VM_COMPILER_STATS_H_ |
| OLD | NEW |