From: Prerna Saxena <prerna@linux.vnet.ibm.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Maneesh Soni <maneesh@linux.vnet.ibm.com>,
Ananth Narayan <ananth@linux.vnet.ibm.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [Tracing][PATCH] Allow bulk enabling of trace events at compile time.
Date: Tue, 13 Jul 2010 17:04:16 +0530 [thread overview]
Message-ID: <20100713170416.6b852cd1@zephyr> (raw)
[PATCH] For 'simple' trace backend, allow bulk enabling/disabling of trace
events at compile time.
Trace events that are preceded by 'disable' keyword are compiled in, but
turned off by default. These can individually be turned on using the monitor.
All other trace events are enabled by default.
TODO :
This could be enhanced when the trace-event namespace is partitioned into a
group and an ID within that group. In such a case, marking a group as enabled
would automatically enable all trace-events listed under it.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
---
trace-events | 3 +++
tracetool | 36 ++++++++++++++++++++++++++++++++----
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/trace-events b/trace-events
index a533414..cb5ef00 100644
--- a/trace-events
+++ b/trace-events
@@ -17,6 +17,9 @@
# Example: qemu_malloc(size_t size) "size %zu"
#
# The "disable" keyword will build without the trace event.
+# In case of 'simple' trace backend, it will allow the trace event to be
+# compiled, but this would be turned off by default. It can be toggled on via
+# the monitor.
#
# The <name> must be a valid as a C function name.
#
diff --git a/tracetool b/tracetool
index b7a0499..98d23fb 100755
--- a/tracetool
+++ b/tracetool
@@ -73,6 +73,20 @@ get_fmt()
echo "$fmt"
}
+# Get the state of a trace event
+get_state()
+{
+ local str disable state
+ str=$(get_name "$1")
+ disable=${str##disable }
+ if [ "$disable" = "$str" ] ; then
+ state=1
+ else
+ state=0
+ fi
+ echo "$state"
+}
+
linetoh_begin_nop()
{
return
@@ -155,12 +169,16 @@ cast_args_to_ulong()
linetoh_simple()
{
- local name args argc ulong_args
+ local name args argc ulong_args state
name=$(get_name "$1")
args=$(get_args "$1")
argc=$(get_argc "$1")
ulong_args=$(cast_args_to_ulong "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ]; then
+ name=${name##disable }
+ fi
cat <<EOF
static inline void trace_$name($args) {
trace$argc($simple_event_num, $ulong_args);
@@ -191,10 +209,14 @@ EOF
linetoc_simple()
{
- local name
+ local name state
name=$(get_name "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ] ; then
+ name=${name##disable }
+ fi
cat <<EOF
-{.tp_name = "$name", .state=0},
+{.tp_name = "$name", .state=$state},
EOF
simple_event_num=$((simple_event_num + 1))
}
@@ -305,7 +327,13 @@ convert()
disable=${str%%disable *}
echo
if test -z "$disable"; then
- "lineto$1_nop" "${str##disable }"
+ # Pass the disabled state as an arg to lineto$1_simple().
+ # For all other cases, call lineto$1_nop()
+ if [ $backend = "simple" ]; then
+ "$process_line" "$str"
+ else
+ "lineto$1_nop" "${str##disable }"
+ fi
else
"$process_line" "$str"
fi
--
1.6.2.5
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
next reply other threads:[~2010-07-13 11:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-13 11:34 Prerna Saxena [this message]
2010-07-13 14:04 ` [Qemu-devel] Re: [Tracing][PATCH] Allow bulk enabling of trace events at compile time 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=20100713170416.6b852cd1@zephyr \
--to=prerna@linux.vnet.ibm.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=maneesh@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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).