OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_TIMELINE_H_ | 5 #ifndef VM_TIMELINE_H_ |
6 #define VM_TIMELINE_H_ | 6 #define VM_TIMELINE_H_ |
7 | 7 |
| 8 #include "include/dart_tools_api.h" |
| 9 |
8 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
9 #include "vm/bitfield.h" | 11 #include "vm/bitfield.h" |
10 #include "vm/os.h" | 12 #include "vm/os.h" |
11 | 13 |
12 namespace dart { | 14 namespace dart { |
13 | 15 |
14 class JSONArray; | 16 class JSONArray; |
15 class JSONObject; | 17 class JSONObject; |
16 class JSONStream; | 18 class JSONStream; |
17 class Object; | 19 class Object; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static void Clear(); | 60 static void Clear(); |
59 | 61 |
60 // Print information about streams to JSON. | 62 // Print information about streams to JSON. |
61 static void PrintFlagsToJSON(JSONStream* json); | 63 static void PrintFlagsToJSON(JSONStream* json); |
62 | 64 |
63 #define ISOLATE_TIMELINE_STREAM_FLAGS(name, not_used) \ | 65 #define ISOLATE_TIMELINE_STREAM_FLAGS(name, not_used) \ |
64 static const bool* Stream##name##EnabledFlag() { \ | 66 static const bool* Stream##name##EnabledFlag() { \ |
65 return &stream_##name##_enabled_; \ | 67 return &stream_##name##_enabled_; \ |
66 } \ | 68 } \ |
67 static void SetStream##name##Enabled(bool enabled) { \ | 69 static void SetStream##name##Enabled(bool enabled) { \ |
| 70 StreamStateChange(#name, stream_##name##_enabled_, enabled); \ |
68 stream_##name##_enabled_ = enabled; \ | 71 stream_##name##_enabled_ = enabled; \ |
69 } | 72 } |
70 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_FLAGS) | 73 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_FLAGS) |
71 #undef ISOLATE_TIMELINE_STREAM_FLAGS | 74 #undef ISOLATE_TIMELINE_STREAM_FLAGS |
72 static void SetVMStreamEnabled(bool enabled); | 75 static void SetVMStreamEnabled(bool enabled); |
73 | 76 |
| 77 static void set_start_recording_cb( |
| 78 Dart_EmbedderTimelineStartRecording start_recording_cb) { |
| 79 start_recording_cb_ = start_recording_cb; |
| 80 } |
| 81 |
| 82 static Dart_EmbedderTimelineStartRecording get_start_recording_cb() { |
| 83 return start_recording_cb_; |
| 84 } |
| 85 |
| 86 static void set_stop_recording_cb( |
| 87 Dart_EmbedderTimelineStopRecording stop_recording_cb) { |
| 88 stop_recording_cb_ = stop_recording_cb; |
| 89 } |
| 90 |
| 91 static Dart_EmbedderTimelineStopRecording get_stop_recording_cb() { |
| 92 return stop_recording_cb_; |
| 93 } |
| 94 |
| 95 static void set_get_timeline_cb( |
| 96 Dart_EmbedderTimelineGetTimeline get_timeline_cb) { |
| 97 get_timeline_cb_ = get_timeline_cb; |
| 98 } |
| 99 |
| 100 static Dart_EmbedderTimelineGetTimeline get_get_timeline_cb() { |
| 101 return get_timeline_cb_; |
| 102 } |
| 103 |
74 private: | 104 private: |
| 105 static void StreamStateChange(const char* stream_name, bool prev, bool curr); |
75 static TimelineEventRecorder* recorder_; | 106 static TimelineEventRecorder* recorder_; |
76 static TimelineStream vm_stream_; | 107 static TimelineStream vm_stream_; |
77 static TimelineStream vm_api_stream_; | 108 static TimelineStream vm_api_stream_; |
78 static MallocGrowableArray<char*>* enabled_streams_; | 109 static MallocGrowableArray<char*>* enabled_streams_; |
| 110 static Dart_EmbedderTimelineStartRecording start_recording_cb_; |
| 111 static Dart_EmbedderTimelineStopRecording stop_recording_cb_; |
| 112 static Dart_EmbedderTimelineGetTimeline get_timeline_cb_; |
79 | 113 |
80 #define ISOLATE_TIMELINE_STREAM_DECLARE_FLAG(name, not_used) \ | 114 #define ISOLATE_TIMELINE_STREAM_DECLARE_FLAG(name, not_used) \ |
81 static bool stream_##name##_enabled_; | 115 static bool stream_##name##_enabled_; |
82 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_DECLARE_FLAG) | 116 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_DECLARE_FLAG) |
83 #undef ISOLATE_TIMELINE_STREAM_DECLARE_FLAG | 117 #undef ISOLATE_TIMELINE_STREAM_DECLARE_FLAG |
84 | 118 |
85 friend class TimelineRecorderOverride; | 119 friend class TimelineRecorderOverride; |
86 friend class ReclaimBlocksIsolateVisitor; | 120 friend class ReclaimBlocksIsolateVisitor; |
87 }; | 121 }; |
88 | 122 |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 802 |
769 private: | 803 private: |
770 TimelineEventBlock* current_; | 804 TimelineEventBlock* current_; |
771 TimelineEventRecorder* recorder_; | 805 TimelineEventRecorder* recorder_; |
772 }; | 806 }; |
773 | 807 |
774 | 808 |
775 } // namespace dart | 809 } // namespace dart |
776 | 810 |
777 #endif // VM_TIMELINE_H_ | 811 #endif // VM_TIMELINE_H_ |
OLD | NEW |