[plt-dev] Profiling

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Sun Sep 27 10:27:30 EDT 2009

I tried to profile some GUI code which uses canvas% but unfortunately I 
get strange results.

AFAIU (most of) the time spent in the C drawing code is accounted for 
but distributed non-uniformly between scheme functions.

My conjecture is that the profiling thread cannot run while the drawing 
is taking place (assuming all Scheme threads are serialized like with 
FFI calls) which causes non-uniform continuation mark sampling. The 
profiler code is correcting for this non-uniformity by adding all the 
time (spent in scheme and C) to the last captured sample (which is not 
likely to be the one that called the C code).

PS. There are some difficulties with profiling in the presence of 
tail-calls but this can be fixed with some use of trace-begin from tail.plt.

Jakub Piotr Cłapa

Posted on the dev mailing list.