yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-trace-install-simpletrace-SystemTap-tapset.patch

9ae3a8
From 13f5df42cd4ccb6d199305b1c82bdd6d39403ae8 Mon Sep 17 00:00:00 2001
9ae3a8
From: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Date: Tue, 7 Oct 2014 14:06:56 +0200
9ae3a8
Subject: [PATCH 38/43] trace: install simpletrace SystemTap tapset
9ae3a8
9ae3a8
Message-id: <1412690820-31016-8-git-send-email-stefanha@redhat.com>
9ae3a8
Patchwork-id: 61612
9ae3a8
O-Subject: [RHEL7.1 qemu-kvm PATCH 07/11] trace: install simpletrace SystemTap tapset
9ae3a8
Bugzilla: 1088112
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
The simpletrace SystemTap tapset outputs simpletrace binary traces for
9ae3a8
SystemTap probes.  This is useful because SystemTap has no default way
9ae3a8
to format or store traces.  The simpletrace SystemTap tapset provides an
9ae3a8
easy way to store traces.
9ae3a8
9ae3a8
The simpletrace.py tool or custom Python scripts using the
9ae3a8
simpletrace.py API can analyze SystemTap these traces:
9ae3a8
9ae3a8
  $ ./configure --enable-trace-backends=dtrace ...
9ae3a8
  $ make && make install
9ae3a8
  $ stap -e 'probe qemu.system.x86_64.simpletrace.* {}' \
9ae3a8
         -c qemu-system-x86_64 >/tmp/trace.out
9ae3a8
  $ scripts/simpletrace.py --no-header trace-events /tmp/trace.out
9ae3a8
  g_malloc 4.531 pid=15519 size=0xb ptr=0x7f8639c10470
9ae3a8
  g_malloc 3.264 pid=15519 size=0x300 ptr=0x7f8639c10490
9ae3a8
  g_free 5.155 pid=15519 ptr=0x7f8639c0f7b0
9ae3a8
9ae3a8
Note that, unlike qemu-system-x86_64.stp and
9ae3a8
qemu-system-x86_64.stp-installed, only one file is needed since the
9ae3a8
simpletrace SystemTap tapset does not reference the QEMU binary by path.
9ae3a8
Therefore it doesn't matter whether the QEMU binary is installed or not.
9ae3a8
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit e0b2fd0efb4d282bc6fa0ed5397f472298a66ca2)
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	Makefile.target
9ae3a8
9ae3a8
Downstream does not have .stp-installed, which was added upstream to
9ae3a8
differentiate between .stp files that can be used in the build tree and
9ae3a8
.stp files that can be used after make install.  Context conflict.
9ae3a8
9ae3a8
Also note that downstream uses --backend=$(TRACE_BACKEND) instead of
9ae3a8
--backends=$(TRACE_BACKENDS).
9ae3a8
9ae3a8
Downstream needs to install the qemu-kvm-simpletrace.stp file right away
9ae3a8
to avoid rpm check "unpackaged file" errors, so modify
9ae3a8
qemu-kvm.spec.template.
9ae3a8
---
9ae3a8
 Makefile.target               | 11 ++++++++++-
9ae3a8
 redhat/qemu-kvm.spec.template | 10 +++++++++-
9ae3a8
 2 files changed, 19 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/Makefile.target b/Makefile.target
9ae3a8
index b871dda..ca407d7 100644
9ae3a8
--- a/Makefile.target
9ae3a8
+++ b/Makefile.target
9ae3a8
@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp
9ae3a8
 config-target.h-timestamp: config-target.mak
9ae3a8
 
9ae3a8
 ifdef CONFIG_TRACE_SYSTEMTAP
9ae3a8
-stap: $(QEMU_PROG).stp
9ae3a8
+stap: $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
9ae3a8
 
9ae3a8
 ifdef CONFIG_USER_ONLY
9ae3a8
 TARGET_TYPE=user
9ae3a8
@@ -51,6 +51,14 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
9ae3a8
 		--target-arch=$(TARGET_ARCH) \
9ae3a8
 		--target-type=$(TARGET_TYPE) \
9ae3a8
 		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
9ae3a8
+
9ae3a8
+$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events
9ae3a8
+	$(call quiet-command,$(TRACETOOL) \
9ae3a8
+		--format=simpletrace-stap \
9ae3a8
+		--backend=$(TRACE_BACKEND) \
9ae3a8
+		--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_ARCH) \
9ae3a8
+		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
9ae3a8
+
9ae3a8
 else
9ae3a8
 stap:
9ae3a8
 endif
9ae3a8
@@ -194,6 +202,7 @@ endif
9ae3a8
 ifdef CONFIG_TRACE_SYSTEMTAP
9ae3a8
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
9ae3a8
 	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
9ae3a8
+	$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
9ae3a8
 endif
9ae3a8
 
9ae3a8
 GENERATED_HEADERS += config-target.h
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8