From patchwork Thu Aug 12 10:36:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 61552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A39F9B6EF1 for ; Thu, 12 Aug 2010 20:38:32 +1000 (EST) Received: from localhost ([127.0.0.1]:37786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjVB6-0004l8-DD for incoming@patchwork.ozlabs.org; Thu, 12 Aug 2010 06:38:28 -0400 Received: from [140.186.70.92] (port=51476 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjV9j-0004jO-Ei for qemu-devel@nongnu.org; Thu, 12 Aug 2010 06:37:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjV9h-0005dv-Nw for qemu-devel@nongnu.org; Thu, 12 Aug 2010 06:37:03 -0400 Received: from mtagate4.de.ibm.com ([195.212.17.164]:56972) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjV9h-0005dk-9Y for qemu-devel@nongnu.org; Thu, 12 Aug 2010 06:37:01 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.1/8.13.1) with ESMTP id o7CAb0jw021870 for ; Thu, 12 Aug 2010 10:37:00 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o7CAb0b31753214 for ; Thu, 12 Aug 2010 12:37:00 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o7CAb0Fq023016 for ; Thu, 12 Aug 2010 12:37:00 +0200 Received: from stefan-thinkpad.ibm.com (dev11556.de.ibm.com [9.145.242.211]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id o7CAahM7022591; Thu, 12 Aug 2010 12:36:58 +0200 From: Stefan Hajnoczi To: Date: Thu, 12 Aug 2010 11:36:34 +0100 Message-Id: <1281609395-17621-14-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1281609395-17621-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1281609395-17621-1-git-send-email-stefanha@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Julien Desfossez , Stefan Hajnoczi , Prerna Saxena Subject: [Qemu-devel] [PATCH 13/14] trace: Add LTTng Userspace Tracer backend X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds LTTng Userspace Tracer (UST) backend support. The UST system requires no kernel support but libust and liburcu must be installed. $ ./configure --trace-backend ust $ make Start the UST daemon: $ ustd & List available tracepoints and enable some: $ ustctl --list-markers $(pgrep qemu) [...] {PID: 5458, channel/marker: ust/paio_submit, state: 0, fmt: "acb %p opaque %p sector_num %lu nb_sectors %lu type %lu" 0x4b32ba} $ ustctl --enable-marker "ust/paio_submit" $(pgrep qemu) Run the trace: $ ustctl --create-trace $(pgrep qemu) $ ustctl --start-trace $(pgrep qemu) [...] $ ustctl --stop-trace $(pgrep qemu) $ ustctl --destroy-trace $(pgrep qemu) Trace results can be viewed using lttv-gui. More information about UST: http://lttng.org/ust Signed-off-by: Stefan Hajnoczi trace: Check for LTTng Userspace Tracer headers When using the 'ust' backend, check if the relevant headers are available at host. Signed-off-by: Prerna Saxena Signed-off-by: Stefan Hajnoczi --- configure | 22 +++++++++++++++- tracetool | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 104 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 5c48a90..3d6dfd4 100755 --- a/configure +++ b/configure @@ -902,7 +902,7 @@ echo " --enable-docs enable documentation build" echo " --disable-docs disable documentation build" echo " --disable-vhost-net disable vhost-net acceleration support" echo " --enable-vhost-net enable vhost-net acceleration support" -echo " --trace-backend=B Trace backend nop simple" +echo " --trace-backend=B Trace backend nop simple ust" echo " --trace-file=NAME Full PATH,NAME of file to store traces" echo " Default:/tmp/trace-" echo " Default:trace- on Windows" @@ -2080,6 +2080,23 @@ if test "$?" -ne 0 ; then exit 1 fi +########################################## +# For 'ust' backend, test if ust headers are present +if test "$trace_backend" = "ust"; then + cat > $TMPC << EOF +#include +#include +int main(void) { return 0; } +EOF + if compile_prog "" "" ; then + LIBS="-lust $LIBS" + else + echo "ERROR: Trace backend 'ust' does not have relevant headers available" + echo " on the host. Pls choose a different backend." + exit 1 + fi +fi +########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -2482,6 +2499,9 @@ if test "$trace_backend" = "simple"; then trace_file="\"$trace_file-%u\"" fi echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak +if test "$trace_backend" = "ust"; then + LIBS="-lust $LIBS" +fi echo "TOOLS=$tools" >> $config_host_mak echo "ROMS=$roms" >> $config_host_mak diff --git a/tracetool b/tracetool index d840e6f..d10c9ee 100755 --- a/tracetool +++ b/tracetool @@ -13,12 +13,13 @@ set -f usage() { cat >&2 <" + ust_clean_namespace +} + +linetoh_ust() +{ + local name args argnames + name=$(get_name "$1") + args=$(get_args "$1") + argnames=$(get_argnames "$1") + + cat < +$(ust_clean_namespace) +#include "trace.h" +EOF +} + +linetoc_ust() +{ + local name args argnames fmt + name=$(get_name "$1") + args=$(get_args "$1") + argnames=$(get_argnames "$1") + fmt=$(get_fmt "$1") + + cat <