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

Unified Diff: runtime/vm/timeline.cc

Issue 1765563002: Stream blocks of timeline events over the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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.h ('k') | runtime/vm/timeline_test.cc » ('j') | 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 be86154914c57b0f843030abd81bd19e5abb0456..2fa59ef6b9f4ead3a48cf1dd0fb58d3220988d24 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -10,6 +10,7 @@
#include "vm/lockers.h"
#include "vm/log.h"
#include "vm/object.h"
+#include "vm/service_event.h"
#include "vm/thread.h"
#include "vm/timeline.h"
@@ -1218,15 +1219,15 @@ void TimelineEventRingRecorder::CompleteEvent(TimelineEvent* event) {
}
-TimelineEventStreamingRecorder::TimelineEventStreamingRecorder() {
+TimelineEventCallbackRecorder::TimelineEventCallbackRecorder() {
}
-TimelineEventStreamingRecorder::~TimelineEventStreamingRecorder() {
+TimelineEventCallbackRecorder::~TimelineEventCallbackRecorder() {
}
-void TimelineEventStreamingRecorder::PrintJSON(JSONStream* js,
+void TimelineEventCallbackRecorder::PrintJSON(JSONStream* js,
TimelineEventFilter* filter) {
if (!FLAG_support_service) {
return;
@@ -1240,7 +1241,7 @@ void TimelineEventStreamingRecorder::PrintJSON(JSONStream* js,
}
-void TimelineEventStreamingRecorder::PrintTraceEvent(
+void TimelineEventCallbackRecorder::PrintTraceEvent(
JSONStream* js,
TimelineEventFilter* filter) {
if (!FLAG_support_service) {
@@ -1250,14 +1251,14 @@ void TimelineEventStreamingRecorder::PrintTraceEvent(
}
-TimelineEvent* TimelineEventStreamingRecorder::StartEvent() {
+TimelineEvent* TimelineEventCallbackRecorder::StartEvent() {
TimelineEvent* event = new TimelineEvent();
return event;
}
-void TimelineEventStreamingRecorder::CompleteEvent(TimelineEvent* event) {
- StreamEvent(event);
+void TimelineEventCallbackRecorder::CompleteEvent(TimelineEvent* event) {
+ OnEvent(event);
delete event;
}
@@ -1396,6 +1397,16 @@ TimelineEventBlock::~TimelineEventBlock() {
}
+void TimelineEventBlock::PrintJSON(JSONStream* js) const {
+ ASSERT(!in_use());
+ JSONArray events(js);
+ for (intptr_t i = 0; i < length(); i++) {
+ const TimelineEvent* event = At(i);
+ events.AddValue(event);
+ }
+}
+
+
TimelineEvent* TimelineEventBlock::StartEvent() {
ASSERT(!IsFull());
if (FLAG_trace_timeline) {
@@ -1465,6 +1476,11 @@ void TimelineEventBlock::Finish() {
OS::Print("Finish block %p\n", this);
}
in_use_ = false;
+ if (Service::timeline_stream.enabled()) {
+ ServiceEvent service_event(NULL, ServiceEvent::kTimelineEvents);
+ service_event.set_timeline_event_block(this);
+ Service::HandleEvent(&service_event);
+ }
}
« no previous file with comments | « runtime/vm/timeline.h ('k') | runtime/vm/timeline_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698