| 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 RUNTIME_VM_TIMELINE_ANALYSIS_H_ | 5 #ifndef RUNTIME_VM_TIMELINE_ANALYSIS_H_ |
| 6 #define RUNTIME_VM_TIMELINE_ANALYSIS_H_ | 6 #define RUNTIME_VM_TIMELINE_ANALYSIS_H_ |
| 7 | 7 |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/timeline.h" | 9 #include "vm/timeline.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 private: | 24 private: |
| 25 void AddBlock(TimelineEventBlock* block); | 25 void AddBlock(TimelineEventBlock* block); |
| 26 void Finalize(); | 26 void Finalize(); |
| 27 | 27 |
| 28 const ThreadId id_; | 28 const ThreadId id_; |
| 29 ZoneGrowableArray<TimelineEventBlock*> blocks_; | 29 ZoneGrowableArray<TimelineEventBlock*> blocks_; |
| 30 | 30 |
| 31 friend class TimelineAnalysis; | 31 friend class TimelineAnalysis; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 | |
| 35 class TimelineAnalysisThreadEventIterator : public ValueObject { | 34 class TimelineAnalysisThreadEventIterator : public ValueObject { |
| 36 public: | 35 public: |
| 37 explicit TimelineAnalysisThreadEventIterator(TimelineAnalysisThread* thread); | 36 explicit TimelineAnalysisThreadEventIterator(TimelineAnalysisThread* thread); |
| 38 ~TimelineAnalysisThreadEventIterator(); | 37 ~TimelineAnalysisThreadEventIterator(); |
| 39 | 38 |
| 40 void Reset(TimelineAnalysisThread* thread); | 39 void Reset(TimelineAnalysisThread* thread); |
| 41 | 40 |
| 42 bool HasNext() const; | 41 bool HasNext() const; |
| 43 | 42 |
| 44 TimelineEvent* Next(); | 43 TimelineEvent* Next(); |
| 45 | 44 |
| 46 private: | 45 private: |
| 47 TimelineAnalysisThread* thread_; | 46 TimelineAnalysisThread* thread_; |
| 48 TimelineEvent* current_; | 47 TimelineEvent* current_; |
| 49 intptr_t block_cursor_; | 48 intptr_t block_cursor_; |
| 50 intptr_t event_cursor_; | 49 intptr_t event_cursor_; |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 | |
| 54 // Base of all timeline analysis classes. Base functionality: | 52 // Base of all timeline analysis classes. Base functionality: |
| 55 // - discovery of all thread ids in a recording. | 53 // - discovery of all thread ids in a recording. |
| 56 // - collecting all ThreadEventBlocks by thread id. | 54 // - collecting all ThreadEventBlocks by thread id. |
| 57 class TimelineAnalysis : public ValueObject { | 55 class TimelineAnalysis : public ValueObject { |
| 58 public: | 56 public: |
| 59 TimelineAnalysis(Zone* zone, | 57 TimelineAnalysis(Zone* zone, |
| 60 Isolate* isolate, | 58 Isolate* isolate, |
| 61 TimelineEventRecorder* recorder); | 59 TimelineEventRecorder* recorder); |
| 62 ~TimelineAnalysis(); | 60 ~TimelineAnalysis(); |
| 63 | 61 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 | 81 |
| 84 Zone* zone_; | 82 Zone* zone_; |
| 85 Isolate* isolate_; | 83 Isolate* isolate_; |
| 86 TimelineEventRecorder* recorder_; | 84 TimelineEventRecorder* recorder_; |
| 87 bool has_error_; | 85 bool has_error_; |
| 88 const char* error_msg_; | 86 const char* error_msg_; |
| 89 | 87 |
| 90 ZoneGrowableArray<TimelineAnalysisThread*> threads_; | 88 ZoneGrowableArray<TimelineAnalysisThread*> threads_; |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 | |
| 94 class TimelineLabelPauseInfo : public ZoneAllocated { | 91 class TimelineLabelPauseInfo : public ZoneAllocated { |
| 95 public: | 92 public: |
| 96 explicit TimelineLabelPauseInfo(const char* name); | 93 explicit TimelineLabelPauseInfo(const char* name); |
| 97 | 94 |
| 98 const char* name() const { return name_; } | 95 const char* name() const { return name_; } |
| 99 | 96 |
| 100 int64_t inclusive_micros() const { return inclusive_micros_; } | 97 int64_t inclusive_micros() const { return inclusive_micros_; } |
| 101 | 98 |
| 102 int64_t exclusive_micros() const { return exclusive_micros_; } | 99 int64_t exclusive_micros() const { return exclusive_micros_; } |
| 103 | 100 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 const char* name_; | 137 const char* name_; |
| 141 int64_t inclusive_micros_; | 138 int64_t inclusive_micros_; |
| 142 int64_t exclusive_micros_; | 139 int64_t exclusive_micros_; |
| 143 int64_t max_inclusive_micros_; | 140 int64_t max_inclusive_micros_; |
| 144 int64_t max_exclusive_micros_; | 141 int64_t max_exclusive_micros_; |
| 145 | 142 |
| 146 friend class TimelinePauses; | 143 friend class TimelinePauses; |
| 147 friend class TimelinePauseTrace; | 144 friend class TimelinePauseTrace; |
| 148 }; | 145 }; |
| 149 | 146 |
| 150 | |
| 151 class TimelinePauses : public TimelineAnalysis { | 147 class TimelinePauses : public TimelineAnalysis { |
| 152 public: | 148 public: |
| 153 TimelinePauses(Zone* zone, Isolate* isolate, TimelineEventRecorder* recorder); | 149 TimelinePauses(Zone* zone, Isolate* isolate, TimelineEventRecorder* recorder); |
| 154 | 150 |
| 155 void Setup(); | 151 void Setup(); |
| 156 | 152 |
| 157 void CalculatePauseTimesForThread(ThreadId tid); | 153 void CalculatePauseTimesForThread(ThreadId tid); |
| 158 | 154 |
| 159 TimelineLabelPauseInfo* GetLabelPauseInfo(const char* name) const; | 155 TimelineLabelPauseInfo* GetLabelPauseInfo(const char* name) const; |
| 160 | 156 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 183 void Push(TimelineEvent* event); | 179 void Push(TimelineEvent* event); |
| 184 bool IsLabelOnStack(const char* label) const; | 180 bool IsLabelOnStack(const char* label) const; |
| 185 intptr_t StackDepth() const; | 181 intptr_t StackDepth() const; |
| 186 StackItem& GetStackTop(); | 182 StackItem& GetStackTop(); |
| 187 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); | 183 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); |
| 188 | 184 |
| 189 ZoneGrowableArray<StackItem> stack_; | 185 ZoneGrowableArray<StackItem> stack_; |
| 190 ZoneGrowableArray<TimelineLabelPauseInfo*> labels_; | 186 ZoneGrowableArray<TimelineLabelPauseInfo*> labels_; |
| 191 }; | 187 }; |
| 192 | 188 |
| 193 | |
| 194 class TimelinePauseTrace : public ValueObject { | 189 class TimelinePauseTrace : public ValueObject { |
| 195 public: | 190 public: |
| 196 TimelinePauseTrace(); | 191 TimelinePauseTrace(); |
| 197 ~TimelinePauseTrace(); | 192 ~TimelinePauseTrace(); |
| 198 | 193 |
| 199 void Print(); | 194 void Print(); |
| 200 | 195 |
| 201 private: | 196 private: |
| 202 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); | 197 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); |
| 203 void Aggregate(const TimelineLabelPauseInfo* thread_pause_info); | 198 void Aggregate(const TimelineLabelPauseInfo* thread_pause_info); |
| 204 void PrintPauseInfo(const TimelineLabelPauseInfo* pause_info); | 199 void PrintPauseInfo(const TimelineLabelPauseInfo* pause_info); |
| 205 | 200 |
| 206 ZoneGrowableArray<TimelineLabelPauseInfo*> isolate_labels_; | 201 ZoneGrowableArray<TimelineLabelPauseInfo*> isolate_labels_; |
| 207 }; | 202 }; |
| 208 | 203 |
| 209 } // namespace dart | 204 } // namespace dart |
| 210 | 205 |
| 211 #endif // RUNTIME_VM_TIMELINE_ANALYSIS_H_ | 206 #endif // RUNTIME_VM_TIMELINE_ANALYSIS_H_ |
| OLD | NEW |