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

Unified Diff: runtime/vm/profiler.cc

Issue 84813002: Profiling fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index cefe428d9800e4bece78a39f4e9b5542b49eb5a7..c45c1d4cc1e3e212c6017495e65341d798bd5790 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -103,11 +103,6 @@ void ProfilerManager::Shutdown() {
{
ScopedMonitor lock(monitor_);
shutdown_ = true;
- for (intptr_t i = 0; i < isolates_size_; i++) {
- Isolate* isolate = isolates_[i];
- ASSERT(isolate != NULL);
- FreeIsolateProfilingData(isolate);
- }
isolates_size_ = 0;
free(isolates_);
isolates_ = NULL;
@@ -180,7 +175,7 @@ void ProfilerManager::ScheduleIsolate(Isolate* isolate, bool inside_signal) {
}
ASSERT(initialized_);
ASSERT(isolate != NULL);
- {
+ if (!inside_signal) {
ScopedSignalBlocker ssb;
{
ScopedMonitor lock(monitor_);
@@ -192,9 +187,25 @@ void ProfilerManager::ScheduleIsolate(Isolate* isolate, bool inside_signal) {
}
profiler_data->Scheduled(OS::GetCurrentTimeMicros(),
Thread::GetCurrentThreadId());
- AddIsolate(isolate);
- lock.Notify();
}
+ AddIsolate(isolate);
+ lock.Notify();
+ }
+ } else {
+ // Do not need a signal blocker inside a signal handler.
+ {
+ ScopedMonitor lock(monitor_);
+ {
+ ScopedMutex profiler_data_lock(isolate->profiler_data_mutex());
+ IsolateProfilerData* profiler_data = isolate->profiler_data();
+ if (profiler_data == NULL) {
+ return;
+ }
+ profiler_data->Scheduled(OS::GetCurrentTimeMicros(),
+ Thread::GetCurrentThreadId());
+ }
+ AddIsolate(isolate);
+ lock.Notify();
}
}
}
@@ -264,6 +275,10 @@ void ProfilerManager::AddIsolate(Isolate* isolate) {
intptr_t ProfilerManager::FindIsolate(Isolate* isolate) {
// Must be called with monitor_ locked.
+ if (isolates_ == NULL) {
+ // We are shutting down.
+ return -1;
+ }
for (intptr_t i = 0; i < isolates_size_; i++) {
if (isolates_[i] == isolate) {
return i;
@@ -275,6 +290,10 @@ intptr_t ProfilerManager::FindIsolate(Isolate* isolate) {
void ProfilerManager::RemoveIsolate(intptr_t i) {
// Must be called with monitor_ locked.
+ if (isolates_ == NULL) {
+ // We are shutting down.
+ return;
+ }
ASSERT(i < isolates_size_);
intptr_t last = isolates_size_ - 1;
if (i != last) {
@@ -577,6 +596,7 @@ ProfilerSampleStackWalker::ProfilerSampleStackWalker(Sample* sample,
int ProfilerSampleStackWalker::walk() {
uword* pc = reinterpret_cast<uword*>(original_pc_);
+#if defined(WALK_STACK)
uword* fp = reinterpret_cast<uword*>(original_fp_);
uword* previous_fp = fp;
if (original_sp_ < lower_bound_) {
@@ -601,6 +621,10 @@ int ProfilerSampleStackWalker::walk() {
lower_bound_ = reinterpret_cast<uintptr_t>(fp);
}
return i;
+#else
+ sample_->pcs[0] = reinterpret_cast<uintptr_t>(pc);
+ return 0;
+#endif
}
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698