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

Unified Diff: src/platform-openbsd.cc

Issue 11437016: Use count-based profiling exclusively. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 8 years 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/platform-macos.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-openbsd.cc
diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc
index 292927bf5e82fbc7758d6849ea3f3534b38c9ba6..d4ab9a66ee7e6c50b8f7ddedde0907b680265ade 100644
--- a/src/platform-openbsd.cc
+++ b/src/platform-openbsd.cc
@@ -784,11 +784,6 @@ class Sampler::PlatformData : public Malloced {
class SignalSender : public Thread {
public:
- enum SleepInterval {
- HALF_INTERVAL,
- FULL_INTERVAL
- };
-
static const int kSignalSenderStackSize = 64 * KB;
explicit SignalSender(int interval)
@@ -844,43 +839,16 @@ class SignalSender : public Thread {
SamplerRegistry::State state;
while ((state = SamplerRegistry::GetState()) !=
SamplerRegistry::HAS_NO_SAMPLERS) {
- bool cpu_profiling_enabled =
- (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
- bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
- if (cpu_profiling_enabled && !signal_handler_installed_) {
- InstallSignalHandler();
- } else if (!cpu_profiling_enabled && signal_handler_installed_) {
- RestoreSignalHandler();
- }
// When CPU profiling is enabled both JavaScript and C++ code is
// profiled. We must not suspend.
- if (!cpu_profiling_enabled) {
- if (rate_limiter_.SuspendIfNecessary()) continue;
- }
- if (cpu_profiling_enabled && runtime_profiler_enabled) {
- if (!SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this)) {
- return;
- }
- Sleep(HALF_INTERVAL);
- if (!SamplerRegistry::IterateActiveSamplers(&DoRuntimeProfile, NULL)) {
- return;
- }
- Sleep(HALF_INTERVAL);
+ if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
+ if (!signal_handler_installed_) InstallSignalHandler();
+ SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
} else {
- if (cpu_profiling_enabled) {
- if (!SamplerRegistry::IterateActiveSamplers(&DoCpuProfile,
- this)) {
- return;
- }
- }
- if (runtime_profiler_enabled) {
- if (!SamplerRegistry::IterateActiveSamplers(&DoRuntimeProfile,
- NULL)) {
- return;
- }
- }
- Sleep(FULL_INTERVAL);
+ if (signal_handler_installed_) RestoreSignalHandler();
+ if (rate_limiter_.SuspendIfNecessary()) continue;
}
+ Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough.
}
}
@@ -890,21 +858,15 @@ class SignalSender : public Thread {
sender->SendProfilingSignal(sampler->platform_data()->vm_tid());
}
- static void DoRuntimeProfile(Sampler* sampler, void* ignored) {
- if (!sampler->isolate()->IsInitialized()) return;
- sampler->isolate()->runtime_profiler()->NotifyTick();
- }
-
void SendProfilingSignal(pthread_t tid) {
if (!signal_handler_installed_) return;
pthread_kill(tid, SIGPROF);
}
- void Sleep(SleepInterval full_or_half) {
+ void Sleep() {
// Convert ms to us and subtract 100 us to compensate delays
// occuring during signal delivery.
useconds_t interval = interval_ * 1000 - 100;
- if (full_or_half == HALF_INTERVAL) interval /= 2;
int result = usleep(interval);
#ifdef DEBUG
if (result != 0 && errno != EINTR) {
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698