Received: from eggs.gnu.org ([140.186.70.92]:41674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYOks-0004av-LW for qemu-devel@nongnu.org; Wed, 07 Dec 2011 16:10:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYOkq-0003oT-GG for qemu-devel@nongnu.org; Wed, 07 Dec 2011 16:10:18 -0500 Received: from gw.ac.upc.edu ([147.83.30.3]:52801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYOkp-0003oL-Ua for qemu-devel@nongnu.org; Wed, 07 Dec 2011 16:10:16 -0500 Received: from localhost (unknown [84.88.53.92]) by gw.ac.upc.edu (Postfix) with ESMTP id 116686B0247 for ; Wed, 7 Dec 2011 22:10:15 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova Date: Wed, 07 Dec 2011 22:10:07 +0100 Message-ID: <20111207211007.24875.39207.stgit@ginnungagap.bsc.es> In-Reply-To: <20111207210936.24875.39375.stgit@ginnungagap.bsc.es> References: <20111207210936.24875.39375.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC 2/4] trace-instrument: Add documentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Llu=C3=ADs 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 @@ +=3D Trace instrumentation =3D + +=3D=3D Introduction =3D=3D + +This document describes how the events provided by the tracing infrastru= cture +described in the document "tracing.txt" can be extended with user-define= d code +that is compiled into QEMU. + +The "instrument" property provides means to statically override and/or w= rap 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-defi= ned code +into the tracing events (e.g., "dtrace"), trace instrumentation is perfo= rmed at +compile time and thus provides means for the tracing hooks to directly i= nteract +with QEMU internals. + +Static trace instrumentation trades the ease and flexibility of existing= tracing +backends with the ability to directly interact with the internal routine= s of +QEMU, as well as the ability to embed highly performant and ad-hoc analy= ses +based on QEMU's tracing events directly into QEMU itself. + + +=3D=3D Quickstart =3D=3D + +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 t= he + headers for the instrumented tracing events: + + cat > /tmp/my-instrument/trace-instrument.h < /tmp/my-intrument/Makefile < /tmp/my-instrument/instrument.c <