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

Unified Diff: runtime/vm/timeline.cc

Issue 1533323004: Support narrowing a timeline to a given time window (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline.cc
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index ab28bee4e6219f5ff9dfe99f0f245a39e0bf7956..11187d72ef29f3505ce891c6cad583fba2142ddf 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -267,8 +267,12 @@ void TimelineEvent::End(const char* label,
}
-void TimelineEvent::SerializedJSON(const char* json) {
+void TimelineEvent::SerializedJSON(const char* json,
+ int64_t timestamp0,
+ int64_t timestamp1) {
Init(kSerializedJSON, "Dart");
+ set_timestamp0(timestamp0);
+ set_timestamp1(timestamp1);
SetNumArguments(1);
CopyArgument(0, "Dart", json);
}
@@ -714,7 +718,12 @@ void TimelineBeginEndScope::EmitEnd() {
}
-TimelineEventFilter::TimelineEventFilter() {
+TimelineEventFilter::TimelineEventFilter(int64_t time_origin_micros,
+ int64_t time_extent_micros)
+ : time_origin_micros_(time_origin_micros),
+ time_extent_micros_(time_extent_micros) {
+ ASSERT(time_origin_micros_ >= -1);
+ ASSERT(time_extent_micros_ >= -1);
}
@@ -722,8 +731,29 @@ TimelineEventFilter::~TimelineEventFilter() {
}
-IsolateTimelineEventFilter::IsolateTimelineEventFilter(Dart_Port isolate_id)
- : isolate_id_(isolate_id) {
+bool TimelineEventFilter::EventInTimeRange(TimelineEvent* event) {
+ if (event == NULL) {
+ return false;
+ }
+ if ((time_origin_micros_ == -1) ||
+ (time_extent_micros_ == -1)) {
+ // No time filter applied.
+ return true;
+ }
+ // TODO(johnmccutchan): Some events span a range of time, check the range and
+ // not just the start time.
+ int64_t delta = event->TimeOrigin() - time_origin_micros_;
+ return (delta >= 0) && (delta <= time_extent_micros_);
+}
+
+
+IsolateTimelineEventFilter::IsolateTimelineEventFilter(
+ Dart_Port isolate_id,
+ int64_t time_origin_micros,
+ int64_t time_extent_micros)
+ : TimelineEventFilter(time_origin_micros,
+ time_extent_micros),
+ isolate_id_(isolate_id) {
}
@@ -937,7 +967,7 @@ void TimelineEventRingRecorder::PrintJSONEvents(
}
for (intptr_t event_idx = 0; event_idx < block->length(); event_idx++) {
TimelineEvent* event = block->At(event_idx);
- if (filter->IncludeEvent(event)) {
+ if (filter->IncludeEvent(event) && filter->EventInTimeRange(event)) {
events->AddValue(event);
}
}
@@ -1129,10 +1159,9 @@ void TimelineEventEndlessRecorder::PrintJSONEvents(
intptr_t length = current->length();
for (intptr_t i = 0; i < length; i++) {
TimelineEvent* event = current->At(i);
- if (!filter->IncludeEvent(event)) {
- continue;
+ if (filter->IncludeEvent(event) && filter->EventInTimeRange(event)) {
+ events->AddValue(event);
}
- events->AddValue(event);
}
current = current->next();
}
« no previous file with comments | « runtime/vm/timeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698