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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/timeline_analysis.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline_analysis.h
diff --git a/runtime/vm/timeline_analysis.h b/runtime/vm/timeline_analysis.h
index 2e12deddc9e9fc5eb930fe53e8331c46db228474..184ccd462095bb88b43ac3072386c03762d464ca 100644
--- a/runtime/vm/timeline_analysis.h
+++ b/runtime/vm/timeline_analysis.h
@@ -105,15 +105,81 @@ class TimelineAnalysis : public ValueObject {
};
+class TimelineLabelPauseInfo : public ZoneAllocated {
+ public:
+ explicit TimelineLabelPauseInfo(const char* name);
+
+ const char* name() const {
+ return name_;
+ }
+
+ int64_t inclusive_micros() const {
+ return inclusive_micros_;
+ }
+
+ int64_t exclusive_micros() const {
+ return exclusive_micros_;
+ }
+
+ int64_t max_duration_micros() const {
+ return max_duration_micros_;
+ }
+
+ private:
+ // Adjusts |inclusive_micros_| and |exclusive_micros_| by |micros|.
+ // Also, may adjust, max_duration_micros_.
+ void OnPush(int64_t micros);
+
+ // Subtracts |micros| from |exclusive_micros_|.
+ void OnChildPush(int64_t micros);
+
+ // Adjust inclusive micros.
+ void add_inclusive_micros(int64_t delta_micros) {
+ inclusive_micros_ += delta_micros;
+ ASSERT(inclusive_micros_ >= 0);
+ }
+
+ // Adjust exclusive micros.
+ void add_exclusive_micros(int64_t delta_micros) {
+ exclusive_micros_ += delta_micros;
+ ASSERT(exclusive_micros_ >= 0);
+ }
+
+ const char* name_;
+ int64_t inclusive_micros_;
+ int64_t exclusive_micros_;
+ int64_t max_duration_micros_;
+
+ friend class TimelinePauses;
+};
+
+
class TimelinePauses : public TimelineAnalysis {
public:
TimelinePauses(Zone* zone,
Isolate* isolate,
TimelineEventRecorder* recorder);
- void CalculatePauseTimes();
+ void Setup();
+
+ void CalculatePauseTimesForThread(ThreadId tid);
+
+ TimelineLabelPauseInfo* GetLabel(const char* name) const;
+
+ int64_t InclusiveTime(const char* name) const;
+ int64_t ExclusiveTime(const char* name) const;
+ int64_t MaxDurationTime(const char* name) const;
private:
+ void ProcessThread(TimelineAnalysisThread* thread);
+ bool CheckStack(TimelineEvent* event);
+ void PopFinished(int64_t start);
+ void Push(TimelineEvent* event);
+ TimelineLabelPauseInfo* GetTopLabel();
+ TimelineLabelPauseInfo* GetOrAddLabel(const char* name);
+
+ ZoneGrowableArray<TimelineEvent*> stack_;
+ ZoneGrowableArray<TimelineLabelPauseInfo*> labels_;
};
} // namespace dart
« 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