From patchwork Wed Dec 7 21:10:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [RFC,2/4] trace-instrument: Add documentation Date: Wed, 07 Dec 2011 11:10:07 -0000 From: =?utf-8?q?Llu=C3=ADs_Vilanova_=3Cvilanova=40ac=2Eupc=2Eedu=3E?= X-Patchwork-Id: 130037 Message-Id: <20111207211007.24875.39207.stgit@ginnungagap.bsc.es> To: qemu-devel@nongnu.org Signed-off-by: LluĂ­s Vilanova --- docs/instrumentation.txt | 142 ++++++++++++++++++++++++++++++++++++++++++++++ docs/tracing.txt | 9 +++ 2 files changed, 151 insertions(+), 0 deletions(-) create mode 100644 docs/instrumentation.txt diff --git a/docs/instrumentation.txt b/docs/instrumentation.txt new file mode 100644 index 0000000..f9f3ce1 --- /dev/null +++ b/docs/instrumentation.txt @@ -0,0 +1,142 @@ += Trace instrumentation = + +== Introduction == + +This document describes how the events provided by the tracing infrastructure +described in the document "tracing.txt" can be extended with user-defined code +that is compiled into QEMU. + +The "instrument" property provides means to statically override and/or wrap the +backend-specific tracing code on a per-event basis when compiling QEMU +(regardless of the tracing backend). + +As opposed to using tracing backends that can dynamically load user-defined code +into the tracing events (e.g., "dtrace"), trace instrumentation is performed at +compile time and thus provides means for the tracing hooks to directly interact +with QEMU internals. + +Static trace instrumentation trades the ease and flexibility of existing tracing +backends with the ability to directly interact with the internal routines of +QEMU, as well as the ability to embed highly performant and ad-hoc analyses +based on QEMU's tracing events directly into QEMU itself. + + +== Quickstart == + +1. Declare which tracing events to instrument: + + sed -i -e "s/qemu_vmalloc(/instrument qemu_vmalloc(/g" trace-events + +2. Create the trace instrumentation header ("trace-instrument.h") with the + headers for the instrumented tracing events: + + cat > /tmp/my-instrument/trace-instrument.h < /tmp/my-intrument/Makefile < /tmp/my-instrument/instrument.c <