Index: runtime/vm/isolate.cc |
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
index 40159cf9d80a7ddcdc6b3e1e0f3850e803d53236..56da593e5413512d2f66df0f312cf15e2f8df281 100644 |
--- a/runtime/vm/isolate.cc |
+++ b/runtime/vm/isolate.cc |
@@ -35,6 +35,7 @@ |
#include "vm/symbols.h" |
#include "vm/tags.h" |
#include "vm/thread_interrupter.h" |
+#include "vm/timeline.h" |
#include "vm/timer.h" |
#include "vm/visitor.h" |
@@ -607,6 +608,7 @@ Isolate::Isolate() |
last_allocationprofile_gc_timestamp_(0), |
object_id_ring_(NULL), |
trace_buffer_(NULL), |
+ timeline_event_buffer_(NULL), |
profiler_data_(NULL), |
thread_state_(NULL), |
tag_table_(GrowableObjectArray::null()), |
@@ -654,6 +656,7 @@ Isolate::~Isolate() { |
delete compiler_stats_; |
compiler_stats_ = NULL; |
} |
+ RemoveTimelineEventBuffer(); |
} |
@@ -681,6 +684,12 @@ Isolate* Isolate::Init(const char* name_prefix, bool is_vm_isolate) { |
ISOLATE_METRIC_LIST(ISOLATE_METRIC_INIT); |
#undef ISOLATE_METRIC_INIT |
+ // Initialize Timeline streams. |
+#define ISOLATE_TIMELINE_STREAM_INIT(name, enabled_by_default) \ |
+ result->stream_##name##_.Init(#name, enabled_by_default); |
+ ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_INIT); |
+#undef ISOLATE_TIMELINE_STREAM_INIT |
+ |
// TODO(5411455): For now just set the recently created isolate as |
// the current isolate. |
Thread::EnterIsolate(result); |
@@ -1394,6 +1403,10 @@ void Isolate::Shutdown() { |
OS::Print("[-] Stopping isolate:\n" |
"\tisolate: %s\n", name()); |
} |
+ |
+ if (timeline_event_buffer_ != NULL) { |
rmacnak
2015/06/08 22:11:30
Behind a flag.
|
+ timeline_event_buffer_->Dump(); |
+ } |
} |
// TODO(5411455): For now just make sure there are no current isolates |
@@ -1492,6 +1505,21 @@ void Isolate::VisitPrologueWeakPersistentHandles(HandleVisitor* visitor) { |
} |
+void Isolate::SetTimelineEventBuffer( |
+ TimelineEventBuffer* timeline_event_buffer) { |
+#define ISOLATE_TIMELINE_STREAM_SET_BUFFER(name, enabled_by_default) \ |
+ stream_##name##_.set_buffer(timeline_event_buffer); |
+ ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_SET_BUFFER) |
+#undef ISOLATE_TIMELINE_STREAM_SET_BUFFER |
+ timeline_event_buffer_ = timeline_event_buffer; |
+} |
+ |
+void Isolate::RemoveTimelineEventBuffer() { |
+ SetTimelineEventBuffer(NULL); |
+ delete timeline_event_buffer_; |
+} |
+ |
+ |
void Isolate::PrintJSON(JSONStream* stream, bool ref) { |
JSONObject jsobj(stream); |
jsobj.AddProperty("type", (ref ? "@Isolate" : "Isolate")); |