On Wed, Oct 20, 2010 at 6:31 PM, Daniel P. Berrange <berra...@redhat.com> wrote: > This introduces a new tracing backend that targets the SystemTAP > implementation of DTrace userspace tracing. The core functionality > should be applicable and standard across any DTrace implementation > on Solaris, OS-X, *BSD, but the Makefile rules will likely need > some small additional changes to cope with OS specific build > requirements. > > This backend builds a little differently from the other tracing > backends. Specifically there is no 'trace.c' file, because the > 'dtrace' command line tool generates a '.o' file directly from > the dtrace probe definition file. The probe definition is usually > named with a '.d' extension but QEMU uses '.d' files for its > external makefile dependancy tracking, so this uses '.dtrace' as > the extension for the probe definition file. > > The 'tracetool' program gains the ability to generate a trace.h > file for DTrace, and also to generate the trace.d file containing > the dtrace probe definition, and finally a qemu.stp file which is > a wrapper around the probe definition providing more convenient > access from SystemTAP scripts. > > eg, instead of > > probe process("qemu").mark("qemu_malloc") { > printf("Malloc %d %p\n", $arg1, $arg2); > } > > The addition of qemu.stp to /usr/share/systemtap/tapset/ > lets users write > > probe qemu.qemu_malloc { > printf("Malloc %d %p\n", size, ptr); > } > > In v2: > > - Add check for 'dtrace' command in configure > - Comply with coding standards in generated code > - Misc fixes to tracetool > - Add more generated files to make clean target > - Mention 'dtrace' backend in configure help > > In v3: > > - Make sure dtrace check in configure only runs > when dtrace backend is selected > > Still todo in v4: > > - Change process("qemu") statement so that it applies > to all 'qemu-system-XXX' binaries not just 'qemu' > > * .gitignore: Ignore trace-dtrace.* > * Makefile: Extra rules for generating DTrace files > * Makefile.obj: Don't build trace.o for DTrace, use > trace-dtrace.o generated by 'dtrace' instead > * tracetool: Support for generating DTrace/SystemTAP > data files > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > --- > .gitignore | 3 + > Makefile | 32 +++++++++++ > Makefile.objs | 4 ++ > configure | 14 +++++- > tracetool | 169 > +++++++++++++++++++++++++++++++++++++++++++++++++++++---- > 5 files changed, 211 insertions(+), 11 deletions(-)
Tested successfully both for launching QEMU and attaching to a running process. This looks promising but it's too bad that utrace isn't upstream. On my Debian testing development machine I need to rebuild the kernel to make use of userspace probes with SystemTap. Acked-by: Stefan Hajnoczi <stefa...@linux.vnet.ibm.com> Stefan