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

Issue 147150: Reimplement profiler sampler on Mac OS X to get it working under Chromium. (Closed)

Created:
11 years, 6 months ago by Mikhail Naganov
Modified:
9 years, 7 months ago
Reviewers:
iposva
CC:
v8-dev
Visibility:
Public.

Description

Reimplement profiler sampler on Mac OS X to get it working under Chromium. Previous implementation of sampler for OS X was copied from the Linux one. But BSD (OS X) and Linux has a very important difference in signal handling. LinuxThreads doesn't support the notion of process-directed signals. So, the SIGPROF signal was directed to the thread that installed the handler---the V8 thread. But on BSD, signal handling is implemented according to POSIX spec, where process-directed signal is to be handled by an arbitrary selected thread. By a coincidence, in V8's sample shell and in Chromium's test shell, V8's thread was picked almost every time, so sampling seemed working. But not in case of Chromium. So, I've changed the implementation of profiler sampler to use the same scheme as on Windows---a dedicated thread with high priority is used to periodically pause and sample V8's thread. Committed: http://code.google.com/p/v8/source/detail?r=2315

Patch Set 1 #

Total comments: 7

Patch Set 2 : Fixes according to Ivan's comments #

Patch Set 3 : Removed accidentally added lines #

Total comments: 2

Patch Set 4 : Factored out stack sampling and moved it under "thread_suspended" condition #

Patch Set 5 : moved thread resuming and got rid of thread_suspended flag #

Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -90 lines) Patch
M src/log.cc View 1 chunk +4 lines, -1 line 0 comments Download
M src/platform.h View 2 3 2 chunks +5 lines, -2 lines 0 comments Download
M src/platform-freebsd.cc View 1 chunk +1 line, -0 lines 0 comments Download
M src/platform-linux.cc View 1 chunk +1 line, -0 lines 0 comments Download
M src/platform-macos.cc View 1 2 3 4 3 chunks +100 lines, -71 lines 0 comments Download
M src/platform-win32.cc View 2 3 4 1 chunk +14 lines, -16 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Mikhail Naganov
Hi Ivan, You seem to be the main expert in Mac OS X. Please look ...
11 years, 6 months ago (2009-06-25 13:34:41 UTC) #1
iposva
First set of comments. Please fix the race conditions and I will take another look. ...
11 years, 6 months ago (2009-06-26 07:48:34 UTC) #2
Mikhail Naganov
Thanks, Ivan! Very insightful comments! http://codereview.chromium.org/147150/diff/1/2 File src/platform-macos.cc (right): http://codereview.chromium.org/147150/diff/1/2#newcode542 Line 542: thread_resume(profiled_thread_); On 2009/06/26 ...
11 years, 6 months ago (2009-06-26 09:56:39 UTC) #3
Mikhail Naganov
Ping!
11 years, 5 months ago (2009-06-29 10:59:31 UTC) #4
iposva
Next round of comments. In short: You are still open to failure in case of ...
11 years, 5 months ago (2009-06-30 00:23:40 UTC) #5
Mikhail Naganov
Thanks, Ivan! I hope now it's OK. http://codereview.chromium.org/147150/diff/8/1008 File src/platform-win32.cc (right): http://codereview.chromium.org/147150/diff/8/1008#newcode1800 Line 1800: sampler_->Tick(&sample); ...
11 years, 5 months ago (2009-06-30 12:33:59 UTC) #6
iposva
11 years, 5 months ago (2009-07-01 05:54:49 UTC) #7
LGTM -ip

Powered by Google App Engine
This is Rietveld 408576698