yuningliang / lightweight-java-profiler

Automatically exported from code.google.com/p/lightweight-java-profiler
Apache License 2.0
0 stars 0 forks source link

Support OS X #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There is enough support currently in head to compile without complaint for OS X 
and do nothing.

The problem is relatively clear.  setitimer(SIGPROF) on OS X seems to be 
delivered to the first thread that doesn't mask it.  This is always the main 
thread, which isn't a Java thread.

A solution is to have a separate thread that wakes up at intervals, suspends a 
random application thread, and profiles it.  This seems to be possible using 
thread_suspend and thread_get_state (in the /usr/include/mach directories).  
I've run out of time to do this today, though, so I'm filing a bug to remind 
myself to do it at some later date.

Original issue reported on code.google.com by jeremy.m...@gmail.com on 3 Aug 2013 at 10:03