开发者

SIGPROF on darwin

开发者 https://www.devze.com 2023-03-19 21:18 出处:网络
setitimer + sigprof doesn\'t work on 64 bit darwin. References: http://openradar.appspot.com/9336975 http://lists.apple.com/archives/Unix-porting/2007/Aug/msg00000.html

setitimer + sigprof doesn't work on 64 bit darwin.

References:

http://openradar.appspot.com/9336975

http://lists.apple.com/archives/Unix-porting/2007/Aug/msg00000.html

Given this, what's the recommended way to build a time based, sampling profiler on darwin? In a mu开发者_JS百科ltithreaded environment.


I ended up creating a separate profiler thread that sleeps for intervals and pthread_kills all other threads with SIGPROF. The SIGPROF handler looks at the how much cpu time the thread consumed and punts if it's too little.

0

精彩评论

暂无评论...
验证码 换一张
取 消