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

Unified Diff: src/platform-linux.cc

Issue 6625013: Start sampler for the runtime profiler even when we can't setup a signal handler. (Closed)
Patch Set: Created 9 years, 10 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index 8a16eb29082d446066d8e38145b878ef7fdeefdb..16aa7c81fdb78a8a090d1c7b28e5d88785e6d901 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -584,7 +584,9 @@ static void* ThreadEntry(void* arg) {
// This is also initialized by the first argument to pthread_create() but we
// don't know which thread will run first (the original thread or the new
// one) so we initialize it here too.
- prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread->name()), 0, 0, 0);
+ prctl(PR_SET_NAME,
+ reinterpret_cast<unsigned long>(thread->name()), // NOLINT
+ 0, 0, 0);
thread->thread_handle_data()->thread_ = pthread_self();
ASSERT(thread->IsValid());
thread->Run();
@@ -871,6 +873,7 @@ class Sampler::PlatformData : public Malloced {
}
void SendProfilingSignal() {
+ if (!signal_handler_installed_) return;
// Glibc doesn't provide a wrapper for tgkill(2).
syscall(SYS_tgkill, vm_tgid_, vm_tid_, SIGPROF);
}
@@ -937,8 +940,8 @@ void Sampler::Start() {
sa.sa_sigaction = ProfilerSignalHandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO;
- if (sigaction(SIGPROF, &sa, &data_->old_signal_handler_) != 0) return;
- data_->signal_handler_installed_ = true;
+ data_->signal_handler_installed_ =
+ sigaction(SIGPROF, &sa, &data_->old_signal_handler_) == 0;
// Start a thread that sends SIGPROF signal to VM thread.
// Sending the signal ourselves instead of relying on itimer provides
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698