| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_PROFILER_H_ | 5 #ifndef VM_PROFILER_H_ |
| 6 #define VM_PROFILER_H_ | 6 #define VM_PROFILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/bitfield.h" | 9 #include "vm/bitfield.h" |
| 10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 static void Shutdown(); | 31 static void Shutdown(); |
| 32 | 32 |
| 33 static void SetSampleDepth(intptr_t depth); | 33 static void SetSampleDepth(intptr_t depth); |
| 34 static void SetSamplePeriod(intptr_t period); | 34 static void SetSamplePeriod(intptr_t period); |
| 35 | 35 |
| 36 static SampleBuffer* sample_buffer() { | 36 static SampleBuffer* sample_buffer() { |
| 37 return sample_buffer_; | 37 return sample_buffer_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 static void SampleAllocation(Thread* thread, intptr_t cid); | 40 static void SampleAllocation(Thread* thread, intptr_t cid); |
| 41 |
| 42 // SampleThread is called from inside the signal handler and hence it is very |
| 43 // critical that the implementation of SampleThread does not do any of the |
| 44 // following: |
| 45 // * Accessing TLS -- Because on Windows the callback will be running in a |
| 46 // different thread. |
| 47 // * Allocating memory -- Because this takes locks which may already be |
| 48 // held, resulting in a dead lock. |
| 49 // * Taking a lock -- See above. |
| 41 static void SampleThread(Thread* thread, | 50 static void SampleThread(Thread* thread, |
| 42 const InterruptedThreadState& state); | 51 const InterruptedThreadState& state); |
| 43 | 52 |
| 44 private: | 53 private: |
| 45 static bool initialized_; | 54 static bool initialized_; |
| 46 static Monitor* monitor_; | 55 static Monitor* monitor_; |
| 47 | 56 |
| 48 static SampleBuffer* sample_buffer_; | 57 static SampleBuffer* sample_buffer_; |
| 49 | 58 |
| 50 friend class Thread; | 59 friend class Thread; |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 531 |
| 523 private: | 532 private: |
| 524 ZoneGrowableArray<ProcessedSample*> samples_; | 533 ZoneGrowableArray<ProcessedSample*> samples_; |
| 525 | 534 |
| 526 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 535 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
| 527 }; | 536 }; |
| 528 | 537 |
| 529 } // namespace dart | 538 } // namespace dart |
| 530 | 539 |
| 531 #endif // VM_PROFILER_H_ | 540 #endif // VM_PROFILER_H_ |
| OLD | NEW |