| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 public: | 48 public: |
| 49 static void InitOnce(); | 49 static void InitOnce(); |
| 50 static void Shutdown(); | 50 static void Shutdown(); |
| 51 | 51 |
| 52 static void SetSampleDepth(intptr_t depth); | 52 static void SetSampleDepth(intptr_t depth); |
| 53 static void SetSamplePeriod(intptr_t period); | 53 static void SetSamplePeriod(intptr_t period); |
| 54 | 54 |
| 55 static SampleBuffer* sample_buffer() { return sample_buffer_; } | 55 static SampleBuffer* sample_buffer() { return sample_buffer_; } |
| 56 | 56 |
| 57 static void DumpStackTrace(void* context); | 57 static void DumpStackTrace(void* context); |
| 58 static void DumpStackTrace(bool native_stack_trace = true); | 58 static void DumpStackTrace(); |
| 59 | 59 |
| 60 static void SampleAllocation(Thread* thread, intptr_t cid); | 60 static void SampleAllocation(Thread* thread, intptr_t cid); |
| 61 | 61 |
| 62 // SampleThread is called from inside the signal handler and hence it is very | 62 // SampleThread is called from inside the signal handler and hence it is very |
| 63 // critical that the implementation of SampleThread does not do any of the | 63 // critical that the implementation of SampleThread does not do any of the |
| 64 // following: | 64 // following: |
| 65 // * Accessing TLS -- Because on Windows the callback will be running in a | 65 // * Accessing TLS -- Because on Windows the callback will be running in a |
| 66 // different thread. | 66 // different thread. |
| 67 // * Allocating memory -- Because this takes locks which may already be | 67 // * Allocating memory -- Because this takes locks which may already be |
| 68 // held, resulting in a dead lock. | 68 // held, resulting in a dead lock. |
| 69 // * Taking a lock -- See above. | 69 // * Taking a lock -- See above. |
| 70 static void SampleThread(Thread* thread, const InterruptedThreadState& state); | 70 static void SampleThread(Thread* thread, const InterruptedThreadState& state); |
| 71 | 71 |
| 72 static ProfilerCounters counters() { | 72 static ProfilerCounters counters() { |
| 73 // Copies the counter values. | 73 // Copies the counter values. |
| 74 return counters_; | 74 return counters_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 static void DumpStackTrace(bool native_stack_trace, | 78 static void DumpStackTrace(uword sp, uword fp, uword pc); |
| 79 uword sp, | |
| 80 uword fp, | |
| 81 uword pc); | |
| 82 | 79 |
| 83 // Does not walk the thread's stack. | 80 // Does not walk the thread's stack. |
| 84 static void SampleThreadSingleFrame(Thread* thread, uintptr_t pc); | 81 static void SampleThreadSingleFrame(Thread* thread, uintptr_t pc); |
| 85 static bool initialized_; | 82 static bool initialized_; |
| 86 | 83 |
| 87 static SampleBuffer* sample_buffer_; | 84 static SampleBuffer* sample_buffer_; |
| 88 | 85 |
| 89 static ProfilerCounters counters_; | 86 static ProfilerCounters counters_; |
| 90 | 87 |
| 91 friend class Thread; | 88 friend class Thread; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 private: | 609 private: |
| 613 ZoneGrowableArray<ProcessedSample*> samples_; | 610 ZoneGrowableArray<ProcessedSample*> samples_; |
| 614 CodeLookupTable* code_lookup_table_; | 611 CodeLookupTable* code_lookup_table_; |
| 615 | 612 |
| 616 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 613 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
| 617 }; | 614 }; |
| 618 | 615 |
| 619 } // namespace dart | 616 } // namespace dart |
| 620 | 617 |
| 621 #endif // RUNTIME_VM_PROFILER_H_ | 618 #endif // RUNTIME_VM_PROFILER_H_ |
| OLD | NEW |