qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Avi Kivity <avi@redhat.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Prerna Saxena <prerna@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 2/7] trace: Support disabled events in trace-events
Date: Tue, 25 May 2010 11:24:11 +0100	[thread overview]
Message-ID: <1274783056-14759-3-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1274783056-14759-1-git-send-email-stefanha@linux.vnet.ibm.com>

Sometimes it is useful to disable a trace event.  Removing the event
from trace-events is not enough since source code will call the
trace_*() function for the event.

This patch makes it easy to build without specific trace events by
marking them disabled in trace-events:

disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"

This builds without the multiwrite_cb trace event.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
v2:
 * This patch is new in v2

 trace-events |    4 +++-
 tracetool    |   10 ++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/trace-events b/trace-events
index a37d3cc..5efaa86 100644
--- a/trace-events
+++ b/trace-events
@@ -12,10 +12,12 @@
 #
 # Format of a trace event:
 #
-# <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>"
+# [disable] <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>"
 #
 # Example: qemu_malloc(size_t size) "size %zu"
 #
+# The "disable" keyword will build without the trace event.
+#
 # The <name> must be a valid as a C function name.
 #
 # Types should be standard C types.  Use void * for pointers because the trace
diff --git a/tracetool b/tracetool
index 766a9ba..53d3612 100755
--- a/tracetool
+++ b/tracetool
@@ -110,7 +110,7 @@ linetoc_end_nop()
 # Process stdin by calling begin, line, and end functions for the backend
 convert()
 {
-    local begin process_line end
+    local begin process_line end str disable
     begin="lineto$1_begin_$backend"
     process_line="lineto$1_$backend"
     end="lineto$1_end_$backend"
@@ -123,8 +123,14 @@ convert()
         str=${str%%#*}
         test -z "$str" && continue
 
+        # Process the line.  The nop backend handles disabled lines.
+        disable=${str%%disable*}
         echo
-        "$process_line" "$str"
+        if test -z "$disable"; then
+            "lineto$1_nop" "${str##disable}"
+        else
+            "$process_line" "$str"
+        fi
     done
 
     echo
-- 
1.7.1

  parent reply	other threads:[~2010-05-25 10:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25 10:24 [Qemu-devel] [PATCH v2 0/7] Tracing backends Stefan Hajnoczi
2010-05-25 10:24 ` [Qemu-devel] [PATCH 1/7] trace: Add trace-events file for declaring trace events Stefan Hajnoczi
2010-06-08  6:34   ` [Qemu-devel] [PATCH] Re: Tracing backends : Fix for building with --prefix Prerna Saxena
2010-06-15 13:49     ` [Qemu-devel] " Stefan Hajnoczi
2010-05-25 10:24 ` Stefan Hajnoczi [this message]
2010-05-25 10:24 ` [Qemu-devel] [PATCH 3/7] trace: Add simple built-in tracing backend Stefan Hajnoczi
2010-05-25 10:24 ` [Qemu-devel] [PATCH 4/7] trace: Add LTTng Userspace Tracer backend Stefan Hajnoczi
2010-05-25 10:24 ` [Qemu-devel] [PATCH 5/7] trace: Trace qemu_malloc() and qemu_vmalloc() Stefan Hajnoczi
2010-05-25 10:24 ` [Qemu-devel] [PATCH 6/7] trace: Trace virtio-blk, multiwrite, and paio_submit Stefan Hajnoczi
2010-05-25 10:24 ` [Qemu-devel] [PATCH 7/7] trace: Trace virtqueue operations Stefan Hajnoczi
2010-05-25 12:04   ` [Qemu-devel] " Avi Kivity
2010-05-25 13:27     ` Stefan Hajnoczi
2010-05-25 13:52       ` Avi Kivity
2010-05-25 14:00         ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274783056-14759-3-git-send-email-stefanha@linux.vnet.ibm.com \
    --to=stefanha@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=prerna@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).