Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: runtime/vm/profiler_android.cc

Issue 92123002: Fix race discovered by Valgrind (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/profiler_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/json_stream.h" 9 #include "vm/json_stream.h"
10 #include "vm/profiler.h" 10 #include "vm/profiler.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 95
96 void ProfilerManager::ThreadMain(uword parameters) { 96 void ProfilerManager::ThreadMain(uword parameters) {
97 ASSERT(initialized_); 97 ASSERT(initialized_);
98 ASSERT(FLAG_profile); 98 ASSERT(FLAG_profile);
99 SignalHandler::Install(ProfileSignalAction); 99 SignalHandler::Install(ProfileSignalAction);
100 if (FLAG_trace_profiled_isolates) { 100 if (FLAG_trace_profiled_isolates) {
101 OS::Print("ProfilerManager Android ready.\n"); 101 OS::Print("ProfilerManager Android ready.\n");
102 } 102 }
103 thread_running_ = true;
104 { 103 {
105 // Signal to main thread we are ready. 104 // Signal to main thread we are ready.
106 ScopedMonitor startup_lock(start_stop_monitor_); 105 ScopedMonitor startup_lock(start_stop_monitor_);
106 thread_running_ = true;
107 startup_lock.Notify(); 107 startup_lock.Notify();
108 } 108 }
109 ScopedMonitor lock(monitor_); 109 ScopedMonitor lock(monitor_);
110 while (!shutdown_) { 110 while (!shutdown_) {
111 int64_t current_time = OS::GetCurrentTimeMicros(); 111 int64_t current_time = OS::GetCurrentTimeMicros();
112 int64_t next_sample = SampleAndRescheduleIsolates(current_time); 112 int64_t next_sample = SampleAndRescheduleIsolates(current_time);
113 lock.WaitMicros(next_sample); 113 lock.WaitMicros(next_sample);
114 } 114 }
115 if (FLAG_trace_profiled_isolates) { 115 if (FLAG_trace_profiled_isolates) {
116 OS::Print("ProfilerManager Android exiting.\n"); 116 OS::Print("ProfilerManager Android exiting.\n");
117 } 117 }
118 thread_running_ = false;
119 { 118 {
120 // Signal to main thread we are exiting. 119 // Signal to main thread we are exiting.
121 ScopedMonitor shutdown_lock(start_stop_monitor_); 120 ScopedMonitor shutdown_lock(start_stop_monitor_);
121 thread_running_ = false;
122 shutdown_lock.Notify(); 122 shutdown_lock.Notify();
123 } 123 }
124 } 124 }
125 125
126 126
127 } // namespace dart 127 } // namespace dart
128 128
129 #endif // defined(TARGET_OS_ANDROID) 129 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/profiler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698