From 576fee71e9691c60dc5d443504c81eae3e249a2f Mon Sep 17 00:00:00 2001
Message-Id: <576fee71e9691c60dc5d443504c81eae3e249a2f.1410282320.git.jen@redhat.com>
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 9 Sep 2014 11:22:31 -0500
Subject: [CHANGE] trace: add systemtap-initscript README file to RPM
To: rhvirt-patches@redhat.com,
    jen@redhat.com

RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: <1410261751-559-1-git-send-email-stefanha@redhat.com>
Patchwork-id: 60918
O-Subject: [RHEL6.6 qemu-kvm PATCH v2] trace: add systemtap-initscript README file to RPM
Bugzilla: 1139438
RH-Acked-by: Jeff Nelson <jenelson@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Ademar de Souza Reis Jr. <areis@redhat.com>

The downstream systemtap-initscript integration is undocumented.  Fix
that with a brief guide containing usage instructions.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
v2:
 * Add more explanation of how to use and customize the scripts [Kevin]

 README.systemtap              | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+), 0 deletions(-)
 create mode 100644 README.systemtap

Signed-off-by: Jeff E. Nelson <jen@redhat.com>
---
 README.systemtap              | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)
 create mode 100644 README.systemtap

diff --git a/README.systemtap b/README.systemtap
new file mode 100644
index 0000000..ad913fc
--- /dev/null
+++ b/README.systemtap
@@ -0,0 +1,43 @@
+QEMU tracing using systemtap-initscript
+---------------------------------------
+
+You can capture QEMU trace data all the time using systemtap-initscript.  This
+uses SystemTap's flight recorder mode to trace all running guests to a
+fixed-size buffer on the host.  Old trace entries are overwritten by new
+entries when the buffer size wraps.
+
+1. Install the systemtap-initscript package:
+  # yum install systemtap-initscript
+
+2. Install the systemtap scripts and the conf file:
+  # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
+  # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
+
+The set of trace events to enable is given in qemu_kvm.stp.  This SystemTap
+script can be customized to add or remove trace events provided in
+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
+
+SystemTap customizations can be made to qemu_kvm.conf to control the flight
+recorder buffer size and whether to store traces in memory only or disk too.
+See stap(1) for option documentation.
+
+3. Start the systemtap service.
+　# service systemtap start qemu_kvm
+
+4. Make the service start at boot time.
+　# chkconfig systemtap on
+
+5. Confirm that the service works.
+  # service systemtap status qemu_kvm
+  qemu_kvm is running...
+
+When you want to inspect the trace buffer, perform the following steps:
+
+1. Dump the trace buffer.
+  # staprun -A qemu_kvm >/tmp/trace.log
+
+2. Start the systemtap service because the preceding step stops the service.
+  # service systemtap start qemu_kvm
+
+3. Translate the trace record to readable format.
+  # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
-- 
1.9.3

