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

Unified Diff: src/platform-win32.cc

Issue 147150: Reimplement profiler sampler on Mac OS X to get it working under Chromium. (Closed)
Patch Set: moved thread resuming and got rid of thread_suspended flag Created 11 years, 6 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/platform-macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index 1b0f9b24d546f3b259eb8bb95da810ca23082dcc..a8a62432130e8b99439c356404e3af9756a6b68b 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -1776,32 +1776,30 @@ class Sampler::PlatformData : public Malloced {
TickSample sample;
// If profiling, we record the pc and sp of the profiled thread.
- if (sampler_->IsProfiling()) {
- // Pause the profiled thread and get its context.
- SuspendThread(profiled_thread_);
+ if (sampler_->IsProfiling()
+ && SuspendThread(profiled_thread_) != (DWORD)-1) {
context.ContextFlags = CONTEXT_FULL;
- GetThreadContext(profiled_thread_, &context);
- // Invoke tick handler with program counter and stack pointer.
+ if (GetThreadContext(profiled_thread_, &context) != 0) {
#if V8_HOST_ARCH_X64
- UNIMPLEMENTED();
- sample.pc = context.Rip;
- sample.sp = context.Rsp;
- sample.fp = context.Rbp;
+ UNIMPLEMENTED();
+ sample.pc = context.Rip;
+ sample.sp = context.Rsp;
+ sample.fp = context.Rbp;
#else
- sample.pc = context.Eip;
- sample.sp = context.Esp;
- sample.fp = context.Ebp;
+ sample.pc = context.Eip;
+ sample.sp = context.Esp;
+ sample.fp = context.Ebp;
#endif
+ sampler_->SampleStack(&sample);
+ }
+ ResumeThread(profiled_thread_);
}
// We always sample the VM state.
sample.state = Logger::state();
+ // Invoke tick handler with program counter and stack pointer.
sampler_->Tick(&sample);
- if (sampler_->IsProfiling()) {
- ResumeThread(profiled_thread_);
- }
-
// Wait until next sampling.
Sleep(sampler_->interval_);
}
« no previous file with comments | « src/platform-macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698