On Sat, May 17, 2008 at 6:56 PM, Nikodemus Siivola
> Tentative implementation attached, based on similar work for
> thread-specific wall-clock profiling by Andreas Bogk.
As Juho noticed, the thread specific :CPU profiling in my patch was
utterly bogus. Here's a revised patch, which incorporates a number of
other improvements as well
grab-bag of SB-SPROF enhancements
* Added support for wallclock profiling. (Good for noticing waits
that do not incur run time penalties.)
* Added keyword arguments :SORT-ORDER (:ASCENDING or :DESCENDING) and
:SORT-BY (:SAMPLES or :CUMULATIVE-SAMPLES) to REPORT, defaulting to
:DESCENDING and :SAMPLES as before. Makes eyeballing flat reports
easier, since often cumulative samples are the ones one should
pay attention to (esp. for :CPU and :TIME profiling.)
* Added support for profiling specific threads. New default is to
profile only the current thread when using WITH-PROFILING, and all
threads when using START-PROFILING -- :THREADS argument to both
WITH-PROFILING and START-PROFILING can be used to specify other
either a specific list of threads to profile, or :ALL to profile
all threads. (In the future we might want to add eg. :CHILDREN
to WITH-PROFILING, etc.)
** For :CPU profiling the signal handler simply filters out the
threads we are not profiling.
** For :ALLOC profiling, *ALLOC-SIGNAL* is now thread local, and
the profiler frobs the global *DEFAULT-ALLOC-SIGNAL* and local
*ALLOC-SIGNAL*s as needed. Before the runtime delivers the
allocation SIGPROF, it sets *ALLOC-SIGNAL* to T to prevent
problems with recursive allocation signals (seem better then
binding it in the handler, since we cannot really bind it
quite early enough no matter what we do.)
** For :TIME profiling, we set up a timer that uses SIGPROF and
pthread_kill to notify threads.
* Use system locking macros instead of separate WITHOUT-GCING and
WITHOUT-INTERRUPTS for cleanliness.
* Make REPORT report the correct sample/alloction interval, and
list the threads sampled.