Index: runtime/vm/profiler_win.cc |
diff --git a/runtime/vm/profiler_win.cc b/runtime/vm/profiler_win.cc |
index 81aa49838322e1eb669dfe75cf150559b884442f..02a7af2afe9976387d8d8e5ca350ecc5e5a839f7 100644 |
--- a/runtime/vm/profiler_win.cc |
+++ b/runtime/vm/profiler_win.cc |
@@ -13,6 +13,7 @@ namespace dart { |
#define kThreadError -1 |
DECLARE_FLAG(bool, profile); |
+DECLARE_FLAG(bool, trace_profiled_isolates); |
static void CollectSample(IsolateProfilerData* profiler_data, |
uintptr_t pc, |
@@ -138,12 +139,30 @@ int64_t ProfilerManager::SampleAndRescheduleIsolates(int64_t current_time) { |
void ProfilerManager::ThreadMain(uword parameters) { |
ASSERT(initialized_); |
ASSERT(FLAG_profile); |
+ if (FLAG_trace_profiled_isolates) { |
+ OS::Print("ProfilerManager Windows ready.\n"); |
+ } |
+ thread_running_ = true; |
+ { |
+ // Signal to main thread we are ready. |
+ ScopedMonitor startup_lock(start_stop_monitor_); |
+ startup_lock.Notify(); |
+ } |
ScopedMonitor lock(monitor_); |
while (!shutdown_) { |
int64_t current_time = OS::GetCurrentTimeMicros(); |
int64_t next_sample = SampleAndRescheduleIsolates(current_time); |
lock.WaitMicros(next_sample); |
} |
+ if (FLAG_trace_profiled_isolates) { |
+ OS::Print("ProfilerManager Windows exiting.\n"); |
+ } |
+ thread_running_ = false; |
+ { |
+ // Signal to main thread we are exiting. |
+ ScopedMonitor shutdown_lock(start_stop_monitor_); |
+ shutdown_lock.Notify(); |
+ } |
} |
} // namespace dart |