| 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 RUNTIME_VM_PROFILER_H_ | 5 #ifndef RUNTIME_VM_PROFILER_H_ |
| 6 #define RUNTIME_VM_PROFILER_H_ | 6 #define RUNTIME_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 public: | 52 public: |
| 53 static void InitOnce(); | 53 static void InitOnce(); |
| 54 static void Shutdown(); | 54 static void Shutdown(); |
| 55 | 55 |
| 56 static void SetSampleDepth(intptr_t depth); | 56 static void SetSampleDepth(intptr_t depth); |
| 57 static void SetSamplePeriod(intptr_t period); | 57 static void SetSamplePeriod(intptr_t period); |
| 58 | 58 |
| 59 static SampleBuffer* sample_buffer() { return sample_buffer_; } | 59 static SampleBuffer* sample_buffer() { return sample_buffer_; } |
| 60 | 60 |
| 61 static void DumpStackTrace(void* context); | 61 static void DumpStackTrace(void* context); |
| 62 static void DumpStackTrace(); | 62 static void DumpStackTrace(bool for_crash = true); |
| 63 | 63 |
| 64 static void SampleAllocation(Thread* thread, intptr_t cid); | 64 static void SampleAllocation(Thread* thread, intptr_t cid); |
| 65 static Sample* SampleNativeAllocation(intptr_t skip_count, | 65 static Sample* SampleNativeAllocation(intptr_t skip_count, |
| 66 uword address, | 66 uword address, |
| 67 uintptr_t allocation_size); | 67 uintptr_t allocation_size); |
| 68 | 68 |
| 69 // SampleThread is called from inside the signal handler and hence it is very | 69 // SampleThread is called from inside the signal handler and hence it is very |
| 70 // critical that the implementation of SampleThread does not do any of the | 70 // critical that the implementation of SampleThread does not do any of the |
| 71 // following: | 71 // following: |
| 72 // * Accessing TLS -- Because on Windows the callback will be running in a | 72 // * Accessing TLS -- Because on Windows the callback will be running in a |
| 73 // different thread. | 73 // different thread. |
| 74 // * Allocating memory -- Because this takes locks which may already be | 74 // * Allocating memory -- Because this takes locks which may already be |
| 75 // held, resulting in a dead lock. | 75 // held, resulting in a dead lock. |
| 76 // * Taking a lock -- See above. | 76 // * Taking a lock -- See above. |
| 77 static void SampleThread(Thread* thread, const InterruptedThreadState& state); | 77 static void SampleThread(Thread* thread, const InterruptedThreadState& state); |
| 78 | 78 |
| 79 static ProfilerCounters counters() { | 79 static ProfilerCounters counters() { |
| 80 // Copies the counter values. | 80 // Copies the counter values. |
| 81 return counters_; | 81 return counters_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 static void DumpStackTrace(uword sp, uword fp, uword pc); | 85 static void DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash); |
| 86 | 86 |
| 87 // Does not walk the thread's stack. | 87 // Does not walk the thread's stack. |
| 88 static void SampleThreadSingleFrame(Thread* thread, uintptr_t pc); | 88 static void SampleThreadSingleFrame(Thread* thread, uintptr_t pc); |
| 89 static bool initialized_; | 89 static bool initialized_; |
| 90 | 90 |
| 91 static SampleBuffer* sample_buffer_; | 91 static SampleBuffer* sample_buffer_; |
| 92 | 92 |
| 93 static ProfilerCounters counters_; | 93 static ProfilerCounters counters_; |
| 94 | 94 |
| 95 friend class Thread; | 95 friend class Thread; |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 private: | 699 private: |
| 700 ZoneGrowableArray<ProcessedSample*> samples_; | 700 ZoneGrowableArray<ProcessedSample*> samples_; |
| 701 CodeLookupTable* code_lookup_table_; | 701 CodeLookupTable* code_lookup_table_; |
| 702 | 702 |
| 703 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 703 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
| 704 }; | 704 }; |
| 705 | 705 |
| 706 } // namespace dart | 706 } // namespace dart |
| 707 | 707 |
| 708 #endif // RUNTIME_VM_PROFILER_H_ | 708 #endif // RUNTIME_VM_PROFILER_H_ |
| OLD | NEW |