From 56a31b90342a6cfc86a00e587a73437a090e993d Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 11 Jul 2014 17:18:24 +0200 Subject: [PATCH 36/44] tracetool: add tracetool simpletrace_stap format RH-Author: Stefan Hajnoczi Message-id: <1405099110-10975-2-git-send-email-stefanha@redhat.com> Patchwork-id: 59859 O-Subject: [RHEL6.6 qemu-kvm PATCH 1/7] tracetool: add tracetool simpletrace_stap format Bugzilla: 905761 RH-Acked-by: Laszlo Ersek RH-Acked-by: Miroslav Rezanina RH-Acked-by: Paolo Bonzini This patch adds the tracetool --simpletrace-stap option for generating a .stp file that outputs simpletrace binary trace data. This is a reimplementation of the following upstream commit: This new tracetool "format" generates a SystemTap .stp file that outputs simpletrace binary trace data. In contrast to simpletrace or ftrace, SystemTap does not define its own trace format. All output from SystemTap is generated by .stp files. This patch lets us generate a .stp file that outputs in the simpletrace binary format. This makes it possible to reuse simpletrace.py to analyze traces recorded using SystemTap. The simpletrace binary format is especially useful for long-running traces like flight-recorder mode where string formatting can be expensive. Signed-off-by: Stefan Hajnoczi RHEL 6.x qemu-kvm uses the shell version of tracetool (upstream tracetool has been Python since QEMU 1.1). Backporting the upstream code would create a huge amount of churn. Since RHEL only needs the dtrace backend, most of the backport would be useless but hard to separate out and review. It's much easier to reimplement the upstream functionality for downstream tracetool. Signed-off-by: Stefan Hajnoczi --- tracetool | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) Signed-off-by: Miroslav Rezanina --- tracetool | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 108 insertions(+), 1 deletions(-) diff --git a/tracetool b/tracetool index f489f43..d00b2a3 100644 --- a/tracetool +++ b/tracetool @@ -13,7 +13,7 @@ set -f usage() { cat >&2 </dev/null + then + cat <" + } catch {} + arg${arg}_len = strlen(arg${arg}_str) +EOF + sizestr="$sizestr + 4 + arg${arg}_len" + fmtstr="$fmtstr%4b%.*s" + fmtargs="$fmtargs, arg${arg}_len, arg${arg}_len, arg${arg}_str" + else + sizestr="$sizestr + 8" + fmtstr="$fmtstr%8b" + fmtargs="$fmtargs, ${arg}" + fi + + IFS=, + done + unset IFS + + # Prepend header fields + sizestr="24$sizestr" + fmtstr="%8b%8b%4b%4b$fmtstr" + fmtargs="$simpletrace_stap_event_id, gettimeofday_ns(), $sizestr, pid()$fmtargs" + + cat <