| 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/code_observers.h" | 10 #include "vm/code_observers.h" |
| 10 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 11 #include "vm/tags.h" | 12 #include "vm/tags.h" |
| 12 #include "vm/thread_interrupter.h" | 13 #include "vm/thread_interrupter.h" |
| 13 | 14 |
| 15 // Profiler sampling and stack walking support. |
| 16 // NOTE: For service related code, see profile_service.h. |
| 17 |
| 14 namespace dart { | 18 namespace dart { |
| 15 | 19 |
| 16 // Forward declarations. | 20 // Forward declarations. |
| 17 class JSONArray; | |
| 18 class JSONStream; | |
| 19 class ProfilerCodeRegionTable; | |
| 20 class Sample; | 21 class Sample; |
| 21 class SampleBuffer; | 22 class SampleBuffer; |
| 22 | 23 |
| 23 // Profiler | 24 |
| 24 class Profiler : public AllStatic { | 25 class Profiler : public AllStatic { |
| 25 public: | 26 public: |
| 26 enum TagOrder { | |
| 27 kNoTags, | |
| 28 kUser, | |
| 29 kUserVM, | |
| 30 kVM, | |
| 31 kVMUser | |
| 32 }; | |
| 33 | |
| 34 static void InitOnce(); | 27 static void InitOnce(); |
| 35 static void Shutdown(); | 28 static void Shutdown(); |
| 36 | 29 |
| 37 static void SetSampleDepth(intptr_t depth); | 30 static void SetSampleDepth(intptr_t depth); |
| 38 static void SetSamplePeriod(intptr_t period); | 31 static void SetSamplePeriod(intptr_t period); |
| 39 | 32 |
| 40 static void InitProfilingForIsolate(Isolate* isolate, | 33 static void InitProfilingForIsolate(Isolate* isolate, |
| 41 bool shared_buffer = true); | 34 bool shared_buffer = true); |
| 42 static void ShutdownProfilingForIsolate(Isolate* isolate); | 35 static void ShutdownProfilingForIsolate(Isolate* isolate); |
| 43 | 36 |
| 44 static void BeginExecution(Isolate* isolate); | 37 static void BeginExecution(Isolate* isolate); |
| 45 static void EndExecution(Isolate* isolate); | 38 static void EndExecution(Isolate* isolate); |
| 46 | 39 |
| 47 static void PrintJSON(Isolate* isolate, JSONStream* stream, | |
| 48 bool full, TagOrder tag_order); | |
| 49 | |
| 50 static SampleBuffer* sample_buffer() { | 40 static SampleBuffer* sample_buffer() { |
| 51 return sample_buffer_; | 41 return sample_buffer_; |
| 52 } | 42 } |
| 53 | 43 |
| 54 private: | 44 private: |
| 55 static bool initialized_; | 45 static bool initialized_; |
| 56 static Monitor* monitor_; | 46 static Monitor* monitor_; |
| 57 | 47 |
| 58 static void RecordSampleInterruptCallback(const InterruptedThreadState& state, | 48 static void RecordSampleInterruptCallback(const InterruptedThreadState& state, |
| 59 void* data); | 49 void* data); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 intptr_t capacity_; | 328 intptr_t capacity_; |
| 339 uintptr_t cursor_; | 329 uintptr_t cursor_; |
| 340 | 330 |
| 341 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); | 331 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); |
| 342 }; | 332 }; |
| 343 | 333 |
| 344 | 334 |
| 345 } // namespace dart | 335 } // namespace dart |
| 346 | 336 |
| 347 #endif // VM_PROFILER_H_ | 337 #endif // VM_PROFILER_H_ |
| OLD | NEW |