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

Unified Diff: runtime/vm/timeline.h

Issue 1386263002: Add support to timeline for begin and end events (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 962a20733af4d583711790cb8e75f445fbad64d0..160caa89f06789dc6b0b28dba71e7897ce7898f8 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -87,6 +87,8 @@ class TimelineEvent {
// Keep in sync with StateBits below.
enum EventType {
kNone,
+ kBegin,
+ kEnd,
kDuration,
kInstant,
kAsyncBegin,
@@ -121,6 +123,12 @@ class TimelineEvent {
int64_t start_micros,
int64_t end_micros);
+ void Begin(const char* label,
+ int64_t micros);
+
+ void End(const char* label,
+ int64_t micros);
+
// Set the number of arguments in the event.
void SetNumArguments(intptr_t length);
// |name| must be a compile time constant. Takes ownership of |argumentp|.
@@ -166,23 +174,50 @@ class TimelineEvent {
return TimeEnd() <= micros;
}
+ bool IsDuration() const {
+ return (event_type() == kDuration);
+ }
+
+ bool IsBegin() const {
+ return (event_type() == kBegin);
+ }
+
+ bool IsEnd() const {
+ return (event_type() == kEnd);
+ }
+
+ // Is this event a synchronous begin or end event?
+ bool IsBeginOrEnd() const {
+ return IsBegin() || IsEnd();
+ }
+
// 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;
+ if (other->IsBegin()) {
+ if (other->TimeOrigin() < TimeOrigin()) {
+ return false;
+ }
+ if (other->TimeOrigin() > TimeEnd()) {
+ return false;
+ }
+ return true;
+ } else {
+ 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;
}
- return true;
}
private:
« 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