Index: runtime/vm/profiler_android.cc |
diff --git a/runtime/vm/profiler_android.cc b/runtime/vm/profiler_android.cc |
index 5d9167cadae2d8bf42a07feb79b57394445e0737..5c351a3e80f1b5d4e0ea9d78e3b42caa400cc37f 100644 |
--- a/runtime/vm/profiler_android.cc |
+++ b/runtime/vm/profiler_android.cc |
@@ -13,7 +13,7 @@ |
namespace dart { |
DECLARE_FLAG(bool, profile); |
- |
+DECLARE_FLAG(bool, trace_profiled_isolates); |
static void ProfileSignalAction(int signal, siginfo_t* info, void* context_) { |
if (signal != SIGPROF) { |
@@ -97,12 +97,30 @@ void ProfilerManager::ThreadMain(uword parameters) { |
ASSERT(initialized_); |
ASSERT(FLAG_profile); |
SignalHandler::Install(ProfileSignalAction); |
+ if (FLAG_trace_profiled_isolates) { |
+ OS::Print("ProfilerManager Android 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 Android exiting.\n"); |
+ } |
+ thread_running_ = false; |
+ { |
+ // Signal to main thread we are exiting. |
+ ScopedMonitor shutdown_lock(start_stop_monitor_); |
+ shutdown_lock.Notify(); |
+ } |
} |