[Webkit-unassigned] [Bug 153584] New: Enable SamplingProfiler on POSIX environment

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 27 22:47:58 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=153584

            Bug ID: 153584
           Summary: Enable SamplingProfiler on POSIX environment
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: utatane.tea at gmail.com

Discussed with Saam, and my rough design is as follows.

= Suspend
1. in the JS thread, install sigaction to the JS execution thread (This should be done in the constructor of the MachineThread)
2. in the profiler, emit signal with pthread_kill and wait with POSIX semaphore
3. in the signal handler, up the POSIX semaphore. Use sem_post because it is the async-signal-safe function in the UNIX environment[1].
4. in the signal handler, perform sigsuspend to stop the thread until being resumed.
5. in the profiler, we can be waken up from the semaphore because (3) ups.

[1]: http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03

NOTE:
Be careful to sigaction timing. Should not emit pthread_kill for the thread that does not install signal handlers yet. (But in the current case, it should not be possible).

= Resume
1. in the profiler, emit signal and wait on the semaphore
2. in the signal handler, it is waken up from the sigsuspend
3. in the signal handler, up the semaphore
4. in the profiler, the profiler is waken up from the semaphore. It is ensured that the given thread is resumed by the signal.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160128/8ccc36e9/attachment-0001.html>


More information about the webkit-unassigned mailing list