[Vm-dev] DTrace for Squeak?

Adrian Lienhard adi at netstyle.ch
Tue May 19 21:20:35 UTC 2009

On May 19, 2009, at 17:54 , Eliot Miranda wrote:

> On Tue, May 19, 2009 at 3:54 AM, Adrian Lienhard <adi at netstyle.ch>  
> wrote:
>> Has anybody considered adding a DTrace user space provider to the VM?
>> This could be very helpful for debugging and profiling (at least on  
>> Mac; I
>> don't know about DTrace for Linux).
>> My man pages on OS X describe the same approach for adding probes  
>> to a C
>> program as in http://blogs.sun.com/ahl/entry/user_land_tracing_gets_better
>> Ruby, Java, Perl, PHP and others have such high-level providers.
> Yes, but things like MethodWrappers can provide excellent visibility  
> and the
> VM already has lots of introspective support for memory usage, garbage
> colleciton timings, context switch counts, etc.  I don't see DTrace  
> as that
> compelling.  What do you see as the costs and benefits?

MethodWrappers and similar approaches cannot be used in a production  
system and they do not help to debug a blocked VM. Furthermore, image- 
level approaches have the drawback that they noticeably influence the  
behavior (e.g., by creating new objects).

I had a few situations where this sort of logging could have saved me  
hours (or days). One example was the problem where Squeak would  
suddenly stop responding to web requests and hog the CPU but would get  
back into normal mode as soon as you wiggle the mouse [1]. I could  
eventually find the root cause by compiling a special VM with John's  
message tracer that can be activated by sending a signal. With DTrace  
I could have just written a simple D script and trace the production  
system when it got into this mood.

DTrace probes are said to have a very low execution overhead if they  
are not active and hence could be added to the VM by default.  
Something else interesting may be that DTrace provides many predefined  
probes for system and library calls that may be useful to combine with  
higher-level Smalltalk probes.

I just hacked a small prototype and this seems to work (Unix VM on OS  


[1] http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-July/119023.html

>> Cheers,
>> Adrian
>> ___________________
>> http://www.adrian-lienhard.ch/

More information about the Vm-dev mailing list