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_ANALYSIS_H_ | 5 #ifndef VM_TIMELINE_ANALYSIS_H_ |
6 #define VM_TIMELINE_ANALYSIS_H_ | 6 #define 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 private: | 132 private: |
133 // Adjusts |inclusive_micros_| and |exclusive_micros_| by |micros|. | 133 // Adjusts |inclusive_micros_| and |exclusive_micros_| by |micros|. |
134 // Also, may adjust, max_inclusive_micros_. | 134 // Also, may adjust, max_inclusive_micros_. |
135 void OnPush(int64_t micros, bool already_on_stack); | 135 void OnPush(int64_t micros, bool already_on_stack); |
136 | 136 |
137 // Adjusts |exclusive_micros_| by |exclusive_micros|. | 137 // Adjusts |exclusive_micros_| by |exclusive_micros|. |
138 // Also, may adjust |max_exclusive_micros_|. | 138 // Also, may adjust |max_exclusive_micros_|. |
139 void OnPop(int64_t exclusive_micros); | 139 void OnPop(int64_t exclusive_micros); |
140 | 140 |
| 141 // Adjusts |inclusive_micros_| and |exclusive_micros_| by |micros|. |
| 142 // Also, may adjust, |max_inclusive_micros_|. |
| 143 void OnBeginPop(int64_t inclusive_micros, |
| 144 int64_t exclusive_micros, |
| 145 bool already_on_stack); |
| 146 |
| 147 void UpdateInclusiveMicros(int64_t inclusive_micros, bool already_on_stack); |
| 148 void UpdateExclusiveMicros(int64_t exclusive_micros); |
| 149 |
141 // Adjust inclusive micros. | 150 // Adjust inclusive micros. |
142 void add_inclusive_micros(int64_t delta_micros) { | 151 void add_inclusive_micros(int64_t delta_micros) { |
143 inclusive_micros_ += delta_micros; | 152 inclusive_micros_ += delta_micros; |
144 ASSERT(inclusive_micros_ >= 0); | 153 ASSERT(inclusive_micros_ >= 0); |
145 } | 154 } |
146 | 155 |
147 // Adjust exclusive micros. | 156 // Adjust exclusive micros. |
148 void add_exclusive_micros(int64_t delta_micros) { | 157 void add_exclusive_micros(int64_t delta_micros) { |
149 exclusive_micros_ += delta_micros; | 158 exclusive_micros_ += delta_micros; |
150 ASSERT(exclusive_micros_ >= 0); | 159 ASSERT(exclusive_micros_ >= 0); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 199 |
191 private: | 200 private: |
192 struct StackItem { | 201 struct StackItem { |
193 TimelineEvent* event; | 202 TimelineEvent* event; |
194 TimelineLabelPauseInfo* pause_info; | 203 TimelineLabelPauseInfo* pause_info; |
195 int64_t exclusive_micros; | 204 int64_t exclusive_micros; |
196 }; | 205 }; |
197 | 206 |
198 void ProcessThread(TimelineAnalysisThread* thread); | 207 void ProcessThread(TimelineAnalysisThread* thread); |
199 bool CheckStack(TimelineEvent* event); | 208 bool CheckStack(TimelineEvent* event); |
200 void PopFinished(int64_t start); | 209 void PopFinishedDurations(int64_t start); |
| 210 void PopBegin(const char* label, int64_t end); |
201 void Push(TimelineEvent* event); | 211 void Push(TimelineEvent* event); |
202 bool IsLabelOnStack(const char* label) const; | 212 bool IsLabelOnStack(const char* label) const; |
203 intptr_t StackDepth() const; | 213 intptr_t StackDepth() const; |
204 StackItem& GetStackTop(); | 214 StackItem& GetStackTop(); |
205 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); | 215 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); |
206 | 216 |
207 ZoneGrowableArray<StackItem> stack_; | 217 ZoneGrowableArray<StackItem> stack_; |
208 ZoneGrowableArray<TimelineLabelPauseInfo*> labels_; | 218 ZoneGrowableArray<TimelineLabelPauseInfo*> labels_; |
209 }; | 219 }; |
210 | 220 |
211 | 221 |
212 class TimelinePauseTrace : public ValueObject { | 222 class TimelinePauseTrace : public ValueObject { |
213 public: | 223 public: |
214 TimelinePauseTrace(); | 224 TimelinePauseTrace(); |
215 ~TimelinePauseTrace(); | 225 ~TimelinePauseTrace(); |
216 | 226 |
217 void Print(); | 227 void Print(); |
218 | 228 |
219 private: | 229 private: |
220 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); | 230 TimelineLabelPauseInfo* GetOrAddLabelPauseInfo(const char* name); |
221 void Aggregate(const TimelineLabelPauseInfo* thread_pause_info); | 231 void Aggregate(const TimelineLabelPauseInfo* thread_pause_info); |
222 void PrintPauseInfo(const TimelineLabelPauseInfo* pause_info); | 232 void PrintPauseInfo(const TimelineLabelPauseInfo* pause_info); |
223 | 233 |
224 ZoneGrowableArray<TimelineLabelPauseInfo*> isolate_labels_; | 234 ZoneGrowableArray<TimelineLabelPauseInfo*> isolate_labels_; |
225 }; | 235 }; |
226 | 236 |
227 } // namespace dart | 237 } // namespace dart |
228 | 238 |
229 #endif // VM_TIMELINE_ANALYSIS_H_ | 239 #endif // VM_TIMELINE_ANALYSIS_H_ |
OLD | NEW |