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_TIMER_H_ | 5 #ifndef VM_TIMER_H_ |
6 #define VM_TIMER_H_ | 6 #define VM_TIMER_H_ |
7 | 7 |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 bool nested_; | 171 bool nested_; |
172 Timer* const timer_; | 172 Timer* const timer_; |
173 | 173 |
174 DISALLOW_ALLOCATION(); | 174 DISALLOW_ALLOCATION(); |
175 DISALLOW_COPY_AND_ASSIGN(TimerScope); | 175 DISALLOW_COPY_AND_ASSIGN(TimerScope); |
176 }; | 176 }; |
177 | 177 |
178 | 178 |
179 class PauseTimerScope : public StackResource { | 179 class PauseTimerScope : public StackResource { |
180 public: | 180 public: |
181 PauseTimerScope(bool flag, Timer* timer, Isolate* isolate = NULL) | 181 PauseTimerScope(bool flag, Timer* timer, Thread* thread = NULL) |
182 : StackResource(isolate), | 182 : StackResource(thread), |
183 nested_(false), | 183 nested_(false), |
184 timer_(flag ? timer : NULL) { | 184 timer_(flag ? timer : NULL) { |
185 if (timer_) { | 185 if (timer_) { |
186 if (timer_->running()) { | 186 if (timer_->running()) { |
187 timer_->Stop(); | 187 timer_->Stop(); |
188 } else { | 188 } else { |
189 nested_ = true; | 189 nested_ = true; |
190 } | 190 } |
191 } | 191 } |
192 } | 192 } |
(...skipping 14 matching lines...) Expand all Loading... |
207 }; | 207 }; |
208 | 208 |
209 | 209 |
210 // Macros to deal with named timers in the isolate. | 210 // Macros to deal with named timers in the isolate. |
211 #define START_TIMER(isolate, name) \ | 211 #define START_TIMER(isolate, name) \ |
212 isolate->timer_list().name().Start(); | 212 isolate->timer_list().name().Start(); |
213 | 213 |
214 #define STOP_TIMER(isolate, name) \ | 214 #define STOP_TIMER(isolate, name) \ |
215 isolate->timer_list().name().Stop(); | 215 isolate->timer_list().name().Stop(); |
216 | 216 |
217 #define TIMERSCOPE(isolate, name) \ | 217 #define TIMERSCOPE(thread, name) \ |
218 TimerScope vm_internal_timer_(true, &(isolate->timer_list().name()), isolate) | 218 TimerScope vm_internal_timer_( \ |
| 219 true, &(thread->isolate()->timer_list().name()), thread) |
219 | 220 |
220 #define PAUSETIMERSCOPE(isolate, name) \ | 221 #define PAUSETIMERSCOPE(thread, name) \ |
221 PauseTimerScope vm_internal_timer_(true, \ | 222 PauseTimerScope vm_internal_timer_(true, \ |
222 &(isolate->timer_list().name()), \ | 223 &(thread->isolate()->timer_list().name()), \ |
223 isolate) | 224 thread) |
224 | 225 |
225 } // namespace dart | 226 } // namespace dart |
226 | 227 |
227 #endif // VM_TIMER_H_ | 228 #endif // VM_TIMER_H_ |
OLD | NEW |