| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class Profiler : public AllStatic { | 47 class Profiler : public AllStatic { |
| 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(bool native_stack_trace = true); | 58 static void DumpStackTrace(bool native_stack_trace = true); |
| 58 | 59 |
| 59 static void SampleAllocation(Thread* thread, intptr_t cid); | 60 static void SampleAllocation(Thread* thread, intptr_t cid); |
| 60 | 61 |
| 61 // 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 |
| 62 // 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 |
| 63 // following: | 64 // following: |
| 64 // * 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 |
| 65 // different thread. | 66 // different thread. |
| 66 // * Allocating memory -- Because this takes locks which may already be | 67 // * Allocating memory -- Because this takes locks which may already be |
| 67 // held, resulting in a dead lock. | 68 // held, resulting in a dead lock. |
| 68 // * Taking a lock -- See above. | 69 // * Taking a lock -- See above. |
| 69 static void SampleThread(Thread* thread, const InterruptedThreadState& state); | 70 static void SampleThread(Thread* thread, const InterruptedThreadState& state); |
| 70 | 71 |
| 71 static ProfilerCounters counters() { | 72 static ProfilerCounters counters() { |
| 72 // Copies the counter values. | 73 // Copies the counter values. |
| 73 return counters_; | 74 return counters_; |
| 74 } | 75 } |
| 75 | 76 |
| 76 private: | 77 private: |
| 78 static void DumpStackTrace(bool native_stack_trace, |
| 79 uword sp, |
| 80 uword fp, |
| 81 uword pc); |
| 82 |
| 77 // Does not walk the thread's stack. | 83 // Does not walk the thread's stack. |
| 78 static void SampleThreadSingleFrame(Thread* thread, uintptr_t pc); | 84 static void SampleThreadSingleFrame(Thread* thread, uintptr_t pc); |
| 79 static bool initialized_; | 85 static bool initialized_; |
| 80 | 86 |
| 81 static SampleBuffer* sample_buffer_; | 87 static SampleBuffer* sample_buffer_; |
| 82 | 88 |
| 83 static ProfilerCounters counters_; | 89 static ProfilerCounters counters_; |
| 84 | 90 |
| 85 friend class Thread; | 91 friend class Thread; |
| 86 }; | 92 }; |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 private: | 612 private: |
| 607 ZoneGrowableArray<ProcessedSample*> samples_; | 613 ZoneGrowableArray<ProcessedSample*> samples_; |
| 608 CodeLookupTable* code_lookup_table_; | 614 CodeLookupTable* code_lookup_table_; |
| 609 | 615 |
| 610 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 616 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
| 611 }; | 617 }; |
| 612 | 618 |
| 613 } // namespace dart | 619 } // namespace dart |
| 614 | 620 |
| 615 #endif // RUNTIME_VM_PROFILER_H_ | 621 #endif // RUNTIME_VM_PROFILER_H_ |
| OLD | NEW |