From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55511 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYg5n-0006n1-50 for qemu-devel@nongnu.org; Tue, 13 Jul 2010 10:04:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYg5f-0006kC-HW for qemu-devel@nongnu.org; Tue, 13 Jul 2010 10:04:11 -0400 Received: from mtagate6.de.ibm.com ([195.212.17.166]:44010) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYg5f-0006k0-8I for qemu-devel@nongnu.org; Tue, 13 Jul 2010 10:04:07 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id o6DE456g019984 for ; Tue, 13 Jul 2010 14:04:05 GMT Received: from d12av03.megacenter.de.ibm.com (d12av03.megacenter.de.ibm.com [9.149.165.213]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6DE45Tc1658938 for ; Tue, 13 Jul 2010 16:04:05 +0200 Received: from d12av03.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av03.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o6DE45G8011341 for ; Tue, 13 Jul 2010 16:04:05 +0200 Date: Tue, 13 Jul 2010 15:04:04 +0100 From: Stefan Hajnoczi Message-ID: <20100713140403.GA27467@stefan-thinkpad.transitives.com> References: <20100713170416.6b852cd1@zephyr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100713170416.6b852cd1@zephyr> Subject: [Qemu-devel] Re: [Tracing][PATCH] Allow bulk enabling of trace events at compile time. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Prerna Saxena Cc: Maneesh Soni , Ananth Narayan , qemu-devel On Tue, Jul 13, 2010 at 05:04:16PM +0530, Prerna Saxena wrote: > [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 > --- Applied, thanks! Stefan > 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 < 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 < -{.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 >