Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: runtime/vm/timeline_analysis.h

Issue 1289113003: Add TimelinePauses analysis and tests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/timeline_analysis.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 Zone* zone_; 98 Zone* zone_;
99 Isolate* isolate_; 99 Isolate* isolate_;
100 TimelineEventRecorder* recorder_; 100 TimelineEventRecorder* recorder_;
101 bool has_error_; 101 bool has_error_;
102 const char* error_msg_; 102 const char* error_msg_;
103 103
104 ZoneGrowableArray<TimelineAnalysisThread*> threads_; 104 ZoneGrowableArray<TimelineAnalysisThread*> threads_;
105 }; 105 };
106 106
107 107
108 class TimelineLabelPauseInfo : public ZoneAllocated {
109 public:
110 explicit TimelineLabelPauseInfo(const char* name);
111
112 const char* name() const {
113 return name_;
114 }
115
116 int64_t inclusive_micros() const {
117 return inclusive_micros_;
118 }
119
120 int64_t exclusive_micros() const {
121 return exclusive_micros_;
122 }
123
124 int64_t max_duration_micros() const {
125 return max_duration_micros_;
126 }
127
128 private:
129 // Adjusts |inclusive_micros_| and |exclusive_micros_| by |micros|.
130 // Also, may adjust, max_duration_micros_.
131 void OnPush(int64_t micros);
132
133 // Subtracts |micros| from |exclusive_micros_|.
134 void OnChildPush(int64_t micros);
135
136 // Adjust inclusive micros.
137 void add_inclusive_micros(int64_t delta_micros) {
138 inclusive_micros_ += delta_micros;
139 ASSERT(inclusive_micros_ >= 0);
140 }
141
142 // Adjust exclusive micros.
143 void add_exclusive_micros(int64_t delta_micros) {
144 exclusive_micros_ += delta_micros;
145 ASSERT(exclusive_micros_ >= 0);
146 }
147
148 const char* name_;
149 int64_t inclusive_micros_;
150 int64_t exclusive_micros_;
151 int64_t max_duration_micros_;
152
153 friend class TimelinePauses;
154 };
155
156
108 class TimelinePauses : public TimelineAnalysis { 157 class TimelinePauses : public TimelineAnalysis {
109 public: 158 public:
110 TimelinePauses(Zone* zone, 159 TimelinePauses(Zone* zone,
111 Isolate* isolate, 160 Isolate* isolate,
112 TimelineEventRecorder* recorder); 161 TimelineEventRecorder* recorder);
113 162
114 void CalculatePauseTimes(); 163 void Setup();
164
165 void CalculatePauseTimesForThread(ThreadId tid);
166
167 TimelineLabelPauseInfo* GetLabel(const char* name) const;
168
169 int64_t InclusiveTime(const char* name) const;
170 int64_t ExclusiveTime(const char* name) const;
171 int64_t MaxDurationTime(const char* name) const;
115 172
116 private: 173 private:
174 void ProcessThread(TimelineAnalysisThread* thread);
175 bool CheckStack(TimelineEvent* event);
176 void PopFinished(int64_t start);
177 void Push(TimelineEvent* event);
178 TimelineLabelPauseInfo* GetTopLabel();
179 TimelineLabelPauseInfo* GetOrAddLabel(const char* name);
180
181 ZoneGrowableArray<TimelineEvent*> stack_;
182 ZoneGrowableArray<TimelineLabelPauseInfo*> labels_;
117 }; 183 };
118 184
119 } // namespace dart 185 } // namespace dart
120 186
121 #endif // VM_TIMELINE_ANALYSIS_H_ 187 #endif // VM_TIMELINE_ANALYSIS_H_
OLDNEW
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/timeline_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698