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

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: Rebaseline Created 7 years, 4 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 | « src/sampler.h ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index 1d0cdedd1fc3a61a9926d3799bf6a4424226d378..1e57c6059f5107e4f89d5e0d15a183d2bbb5ca05 100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -174,7 +174,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_;
@@ -492,9 +493,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 defined(__MACH__)
@@ -607,6 +606,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
//
@@ -665,6 +672,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) {
@@ -705,4 +713,20 @@ void Sampler::SampleStack(const RegisterState& state) {
Tick(sample);
}
+
+bool Sampler::CanSampleOnProfilerEventsProcessorThread() {
+#if defined(USE_SIGNALS)
+ return true;
+#else
+ return false;
+#endif
+}
+
+
+void Sampler::DoSample() {
+#if defined(USE_SIGNALS)
+ platform_data()->SendProfilingSignal();
+#endif
+}
+
} } // namespace v8::internal
« no previous file with comments | « 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