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

Unified Diff: src/sampler.cc

Issue 21101002: Support higher CPU profiler sampling rate on posix systems (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
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
« src/cpu-profiler.cc ('K') | « src/sampler.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698