| Index: src/sampler.cc
|
| diff --git a/src/sampler.cc b/src/sampler.cc
|
| index d10a5392204214ba6317d8a6b2a494922ef89458..b5eee71b9ce3982557db469219cf359fe44b0c89 100644
|
| --- a/src/sampler.cc
|
| +++ b/src/sampler.cc
|
| @@ -169,7 +169,8 @@ class PlatformDataCommon : public Malloced {
|
| class Sampler::PlatformData : public PlatformDataCommon {
|
| public:
|
| PlatformData() : vm_tid_(pthread_self()) {}
|
| - pthread_t vm_tid() const { return vm_tid_; }
|
| +
|
| + void SendProfilingSignal() const;
|
|
|
| private:
|
| pthread_t vm_tid_;
|
| @@ -486,9 +487,7 @@ class SamplerThread : public Thread {
|
| #if defined(USE_SIGNALS)
|
|
|
| void SampleContext(Sampler* sampler) {
|
| - if (!SignalHandler::Installed()) return;
|
| - pthread_t tid = sampler->platform_data()->vm_tid();
|
| - pthread_kill(tid, SIGPROF);
|
| + sampler->platform_data()->SendProfilingSignal();
|
| }
|
|
|
| #elif V8_OS_DARWIN
|
| @@ -601,6 +600,14 @@ Mutex* SamplerThread::mutex_ = NULL;
|
| SamplerThread* SamplerThread::instance_ = NULL;
|
|
|
|
|
| +#if defined(USE_SIGNALS)
|
| +void Sampler::PlatformData::SendProfilingSignal() const {
|
| + if (!SignalHandler::Installed()) return;
|
| + pthread_kill(vm_tid_, SIGPROF);
|
| +}
|
| +#endif
|
| +
|
| +
|
| //
|
| // StackTracer implementation
|
| //
|
| @@ -660,6 +667,7 @@ Sampler::Sampler(Isolate* isolate, int interval)
|
| : isolate_(isolate),
|
| interval_(interval),
|
| profiling_(false),
|
| + has_processing_thread_(false),
|
| active_(false),
|
| is_counting_samples_(false),
|
| js_and_external_sample_count_(0) {
|
| @@ -700,4 +708,18 @@ void Sampler::SampleStack(const RegisterState& state) {
|
| Tick(sample);
|
| }
|
|
|
| +
|
| +bool Sampler::CanSampleOnProfilerEventsProcessorThread() {
|
| +#if defined(USE_SIGNALS)
|
| + return true;
|
| +#else
|
| + return false;
|
| +#endif
|
| +}
|
| +
|
| +
|
| +void Sampler::DoSample() {
|
| + platform_data()->SendProfilingSignal();
|
| +}
|
| +
|
| } } // namespace v8::internal
|
|
|