Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
| index 2432df990bfa34e8945bc702086c827c4bef13c6..bc50eba672afd154cdf20cbb03c165da0bdf68bf 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" |
| @@ -368,6 +369,8 @@ void IsolateMessageHandler::MessageNotify(Message::Priority priority) { |
| bool IsolateMessageHandler::HandleMessage(Message* message) { |
| StackZone zone(I); |
| HandleScope handle_scope(I); |
| + TimelineDurationScope tds(I, I->GetIsolateStream(), "HandleMessage"); |
| + |
| // TODO(turnidge): Rework collection total dart execution. This can |
| // overcount when other things (gc, compilation) are active. |
| TIMERSCOPE(isolate_, time_dart_execution); |
| @@ -662,6 +665,7 @@ Isolate::Isolate(const Dart_IsolateFlags& api_flags) |
| 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()), |
| @@ -710,6 +714,7 @@ Isolate::~Isolate() { |
| delete compiler_stats_; |
| compiler_stats_ = NULL; |
| } |
| + RemoveTimelineEventBuffer(); |
| } |
| @@ -739,6 +744,12 @@ Isolate* Isolate::Init(const char* name_prefix, |
| 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); |
| @@ -963,6 +974,12 @@ bool Isolate::MakeRunnable() { |
| ASSERT(this == state->isolate()); |
| Run(); |
| } |
| + TimelineStream* stream = GetIsolateStream(); |
| + ASSERT(stream != NULL); |
| + TimelineEvent* event = stream->RecordEvent(); |
| + if (event != NULL) { |
| + event->Instant(stream, "Runnable"); |
| + } |
| return true; |
| } |
| @@ -1452,6 +1469,10 @@ void Isolate::Shutdown() { |
| OS::Print("[-] Stopping isolate:\n" |
| "\tisolate: %s\n", name()); |
| } |
| + |
| + if (timeline_event_buffer_ != NULL) { |
|
rmacnak
2015/06/10 20:25:14
Behind a flag
Cutch
2015/06/10 21:20:57
This will be gone before I commit.
|
| + timeline_event_buffer_->Dump(); |
| + } |
| } |
| // TODO(5411455): For now just make sure there are no current isolates |
| @@ -1550,6 +1571,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")); |