From patchwork Tue Jul 13 11:34:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Tracing] Allow bulk enabling of trace events at compile time. Date: Tue, 13 Jul 2010 01:34:16 -0000 From: Prerna Saxena X-Patchwork-Id: 58770 Message-Id: <20100713170416.6b852cd1@zephyr> To: qemu-devel Cc: Maneesh Soni , Ananth Narayan , Stefan Hajnoczi [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 --- 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 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 <