[Openmcl-devel] DTrace and ccl
R. Matthew Emerson
rme at clozure.com
Wed Oct 12 16:13:23 UTC 2011
Quoting from the DTrace book:
DTrace is a observability technology that allows you to answer
countless questions about how systems and applications are
behaving in development and in production.
I'm a DTrace novice (at best), but I've been experimenting with
adding some DTrace probes to the lisp kernel. The very latest
trunk ccl contains some experimental DTrace probes that work on
Darwin x86 and x86-64 systems.
The probes are as follows:
Fired when a full gc starts or ends. The argument to gc-start
is the number of bytes allocated. The argument to gc-finish
is the number of bytes freed.
egc-start(unsigned long, unsigned);
egc-finish(unsigned long, unsigned);
Fired when an egc starts or ends. The first argument is the
number of bytes allocated (for egc-start) or number of bytes
freed (for egc-finish). The second argument is the generation
Fired when a new thread is created. The argument is the OS
Here's a script that sort of reproduces the results of
setting ccl::*gc-event-status-bits* to (ash 1 ccl::$egc-verbose-bit).
#pragma D option quiet
unsigned long bytes_used, start;
i = 0;
printf("%8s %14s %8s %8s\n", "serial", "elapsed ns", "K used", "K freed");
bytes_used = arg0;
start = walltimestamp;
printf("%8u %14u %8u %8u\n", i++, walltimestamp - start, bytes_used, arg0);
Save this as "junk.d" or whatever. Start a ccl in a terminal, and
find out what its pid is. (#_getpid) is one way.
Then, run the script in another terminal as "sudo ./junk.d 1234",
where 1234 is the pid you found above.
Now, make the lisp start consing in your preferred way, and you
should see some output from the D script.
If you know a lot about DTrace, would you consider getting in touch?
Adding more DTrace support to ccl seems like a promising avenue, but
I almost don't know what questions to ask.
For instance, perhaps we could use DTrace for profiling if it would be
possible to write a DTrace ustack helper for ccl. (At one point, ustack
helpers couldn't be built on Mac OS X, but there's still the Solaris
More information about the Openmcl-devel