From patchwork Wed Dec 7 21:10:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 130037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8D6161007D5 for ; Thu, 8 Dec 2011 08:10:37 +1100 (EST) Received: from localhost ([::1]:46187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYOkz-0004cL-NK for incoming@patchwork.ozlabs.org; Wed, 07 Dec 2011 16:10:25 -0500 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) To: qemu-devel@nongnu.org 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> User-Agent: StGit/0.15 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 147.83.30.3 Subject: [Qemu-devel] [PATCH RFC 2/4] trace-instrument: Add documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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 <