Blob Blame History Raw
From 13f5df42cd4ccb6d199305b1c82bdd6d39403ae8 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 7 Oct 2014 14:06:56 +0200
Subject: [PATCH 38/43] trace: install simpletrace SystemTap tapset

Message-id: <1412690820-31016-8-git-send-email-stefanha@redhat.com>
Patchwork-id: 61612
O-Subject: [RHEL7.1 qemu-kvm PATCH 07/11] trace: install simpletrace SystemTap tapset
Bugzilla: 1088112
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

The simpletrace SystemTap tapset outputs simpletrace binary traces for
SystemTap probes.  This is useful because SystemTap has no default way
to format or store traces.  The simpletrace SystemTap tapset provides an
easy way to store traces.

The simpletrace.py tool or custom Python scripts using the
simpletrace.py API can analyze SystemTap these traces:

  $ ./configure --enable-trace-backends=dtrace ...
  $ make && make install
  $ stap -e 'probe qemu.system.x86_64.simpletrace.* {}' \
         -c qemu-system-x86_64 >/tmp/trace.out
  $ scripts/simpletrace.py --no-header trace-events /tmp/trace.out
  g_malloc 4.531 pid=15519 size=0xb ptr=0x7f8639c10470
  g_malloc 3.264 pid=15519 size=0x300 ptr=0x7f8639c10490
  g_free 5.155 pid=15519 ptr=0x7f8639c0f7b0

Note that, unlike qemu-system-x86_64.stp and
qemu-system-x86_64.stp-installed, only one file is needed since the
simpletrace SystemTap tapset does not reference the QEMU binary by path.
Therefore it doesn't matter whether the QEMU binary is installed or not.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit e0b2fd0efb4d282bc6fa0ed5397f472298a66ca2)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

Conflicts:
	Makefile.target

Downstream does not have .stp-installed, which was added upstream to
differentiate between .stp files that can be used in the build tree and
.stp files that can be used after make install.  Context conflict.

Also note that downstream uses --backend=$(TRACE_BACKEND) instead of
--backends=$(TRACE_BACKENDS).

Downstream needs to install the qemu-kvm-simpletrace.stp file right away
to avoid rpm check "unpackaged file" errors, so modify
qemu-kvm.spec.template.
---
 Makefile.target               | 11 ++++++++++-
 redhat/qemu-kvm.spec.template | 10 +++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index b871dda..ca407d7 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp
 config-target.h-timestamp: config-target.mak
 
 ifdef CONFIG_TRACE_SYSTEMTAP
-stap: $(QEMU_PROG).stp
+stap: $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
 
 ifdef CONFIG_USER_ONLY
 TARGET_TYPE=user
@@ -51,6 +51,14 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
 		--target-arch=$(TARGET_ARCH) \
 		--target-type=$(TARGET_TYPE) \
 		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
+
+$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events
+	$(call quiet-command,$(TRACETOOL) \
+		--format=simpletrace-stap \
+		--backend=$(TRACE_BACKEND) \
+		--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_ARCH) \
+		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
+
 else
 stap:
 endif
@@ -194,6 +202,7 @@ endif
 ifdef CONFIG_TRACE_SYSTEMTAP
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
 	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
+	$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
 endif
 
 GENERATED_HEADERS += config-target.h
-- 
1.8.3.1