cryptospore / rpms / qemu-kvm

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