From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52827 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFvwD-0005fG-6h for qemu-devel@nongnu.org; Sat, 22 May 2010 17:08:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFvvz-0004RR-CC for qemu-devel@nongnu.org; Sat, 22 May 2010 17:08:53 -0400 Received: from mtagate1.de.ibm.com ([195.212.17.161]:48943) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFvvz-0004Qh-2K for qemu-devel@nongnu.org; Sat, 22 May 2010 17:08:39 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.1/8.13.1) with ESMTP id o4ML8aqT001145 for ; Sat, 22 May 2010 21:08:36 GMT Received: from d12av04.megacenter.de.ibm.com (d12av04.megacenter.de.ibm.com [9.149.165.229]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o4ML8Vs2856098 for ; Sat, 22 May 2010 23:08:36 +0200 Received: from d12av04.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o4ML8UF6021985 for ; Sat, 22 May 2010 23:08:30 +0200 From: Stefan Hajnoczi Date: Sat, 22 May 2010 22:08:21 +0100 Message-Id: <1274562503-10713-4-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1274562503-10713-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1274562503-10713-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 3/5] trace: Add LTTng Userspace Tracer backend List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kvm@vger.kernel.org Cc: Jan Kiszka , Anthony Liguori , Stefan Hajnoczi , Prerna Saxena 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 --- I wrote this as part of trying out UST. Although UST is promising, the usability is poor at the moment. The dependencies include the lttv trace viewer which I had to build from source (and it required a makefile tweak to build). Luckily libust, liburcu, and ust-bin are packaged on my distro. Error messages are periodically printed by the UST code when running QEMU. I haven't investigated but this is may be due to signals interrupting UST's thread in poll(). Finally, the UST header files include some userspace ported kernel infrastructure and pollute the namespace. I had to add some #undefs to get QEMU to build after including UST headers. I don't see LTTng UST as a default option at the moment. Hopefully this will change in the future. configure | 5 +++- tracetool | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/configure b/configure index d599879..307dbcb 100755 --- a/configure +++ b/configure @@ -829,7 +829,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 "" echo "NOTE: The object files are built at the place where configure is launched" exit 1 @@ -2302,6 +2302,9 @@ bsd) esac echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak +if test "$trace_backend" = "ust"; then + LIBS="-lust $LIBS" +fi tools= if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then diff --git a/tracetool b/tracetool index bcd163e..72beb20 100755 --- a/tracetool +++ b/tracetool @@ -3,12 +3,13 @@ usage() { cat >&2 <" +} + +linetoh_ust() +{ + local name args argnames + name=$(get_name "$1") + args=$(get_args "$1") + argnames=$(get_argnames "$1") + + cat < +#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 <