From patchwork Mon Aug 30 13:27:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [08/14] trace: Add LTTng Userspace Tracer backend Date: Mon, 30 Aug 2010 03:27:10 -0000 From: Stefan Hajnoczi X-Patchwork-Id: 63035 Message-Id: <1283174836-6330-9-git-send-email-stefanha@linux.vnet.ibm.com> To: Cc: Blue Swirl , 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 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 ad21c58..d3b275d 100755 --- a/configure +++ b/configure @@ -904,7 +904,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" @@ -2082,6 +2082,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 @@ -2484,6 +2501,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 <