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

Unified Diff: runtime/vm/timeline.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 | « no previous file | runtime/vm/timeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline.h
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index 3cda6c92337ec8ffb7081a83bc74852a510ae0f1..273df848e7546e4f3a77a8835aabcc190874b051 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -81,9 +81,17 @@ class TimelineEvent {
return EventTypeField::decode(state_);
}
+ bool IsFinishedDuration() const {
+ return (event_type() == kDuration) && (timestamp1_ > timestamp0_);
+ }
+
int64_t TimeOrigin() const;
int64_t AsyncId() const;
int64_t TimeDuration() const;
+ int64_t TimeEnd() const {
+ ASSERT(IsFinishedDuration());
+ return timestamp1_;
+ }
void PrintJSON(JSONStream* stream) const;
@@ -95,6 +103,30 @@ class TimelineEvent {
return label_;
}
+ // Does this duration end before |micros| ?
+ bool DurationFinishedBefore(int64_t micros) const {
+ return TimeEnd() <= micros;
+ }
+
+ // Does this duration fully contain |other| ?
+ bool DurationContains(TimelineEvent* other) const {
+ ASSERT(IsFinishedDuration());
+ ASSERT(other->IsFinishedDuration());
+ if (other->TimeOrigin() < TimeOrigin()) {
+ return false;
+ }
+ if (other->TimeEnd() < TimeOrigin()) {
+ return false;
+ }
+ if (other->TimeOrigin() > TimeEnd()) {
+ return false;
+ }
+ if (other->TimeEnd() > TimeEnd()) {
+ return false;
+ }
+ return true;
+ }
+
private:
struct TimelineEventArgument {
const char* name;
@@ -371,6 +403,7 @@ class TimelineEventRecorder {
friend class TimelineEventBlockIterator;
friend class TimelineStream;
+ friend class TimelineTestHelper;
friend class Isolate;
private:
@@ -468,8 +501,13 @@ class TimelineEventEndlessRecorder : public TimelineEventRecorder {
TimelineEventBlock* GetNewBlockLocked();
void PrintJSONEvents(JSONArray* array) const;
+ // Useful only for testing. Only works for one thread.
+ void Clear();
+
TimelineEventBlock* head_;
intptr_t block_index_;
+
+ friend class TimelineTestHelper;
};
« no previous file with comments | « no previous file | runtime/vm/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698