Index: runtime/vm/profiler_macos.cc |
diff --git a/runtime/vm/profiler_macos.cc b/runtime/vm/profiler_macos.cc |
index eb2888d1417f07cc35d427c44b1e69feee77e018..f891d6e46335ae5843baa797b0a5b790370e94f9 100644 |
--- a/runtime/vm/profiler_macos.cc |
+++ b/runtime/vm/profiler_macos.cc |
@@ -13,6 +13,7 @@ |
namespace dart { |
DECLARE_FLAG(bool, profile); |
+DECLARE_FLAG(bool, trace_profiled_isolates); |
static void CollectSample(IsolateProfilerData* profiler_data, |
uintptr_t pc, |
@@ -129,12 +130,30 @@ void ProfilerManager::ThreadMain(uword parameters) { |
ASSERT(initialized_); |
ASSERT(FLAG_profile); |
SignalHandler::Install(ProfileSignalAction); |
+ if (FLAG_trace_profiled_isolates) { |
+ OS::Print("ProfilerManager MacOS 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 MacOS exiting.\n"); |
+ } |
+ thread_running_ = false; |
+ { |
+ // Signal to main thread we are exiting. |
+ ScopedMonitor shutdown_lock(start_stop_monitor_); |
+ shutdown_lock.Notify(); |
+ } |
} |