From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7Xwc-0003Dv-2R for qemu-devel@nongnu.org; Tue, 13 Mar 2012 16:03:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7XwV-00081W-Hc for qemu-devel@nongnu.org; Tue, 13 Mar 2012 16:03:41 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:38919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7XwV-000818-7E for qemu-devel@nongnu.org; Tue, 13 Mar 2012 16:03:35 -0400 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Tue, 13 Mar 2012 21:03:27 +0100 Message-Id: <20120313200327.24179.48972.stgit@ginnungagap.bsc.es> In-Reply-To: <20120313200235.24179.63987.stgit@ginnungagap.bsc.es> References: <20120313200235.24179.63987.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 09/12] trace: [tracetool] Make format-specific code optional and with access to events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, harsh@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com First, routines for format-specific code are not mandatory. Second, all format-specific routines get the list of events as an argumen= t. Signed-off-by: Llu=C3=ADs Vilanova Signed-off-by: Harsh Prateek Bora --- scripts/tracetool.py | 32 ++++++++++---------------------- 1 files changed, 10 insertions(+), 22 deletions(-) diff --git a/scripts/tracetool.py b/scripts/tracetool.py index f017053..377c683 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -39,7 +39,7 @@ Options: ''' sys.exit(1) =20 -def trace_h_begin(): +def trace_h_begin(events): print '''#ifndef TRACE_H #define TRACE_H =20 @@ -47,17 +47,12 @@ def trace_h_begin(): =20 #include "qemu-common.h"''' =20 - -def trace_h_end(): +def trace_h_end(events): print '#endif /* TRACE_H */' =20 - -def trace_c_begin(): +def trace_c_begin(events): print '/* This file is autogenerated by tracetool, do not edit. */' =20 -def trace_c_end(): - pass # nop, required for trace_gen - def nop_h(events): print for event in events: @@ -284,18 +279,12 @@ probe %(probeprefix)s.%(name)s =3D process("%(binar= y)s").mark("%(name)s") def dtrace_nop_stp(events): pass =20 -def trace_stap_begin(): +def trace_stap_begin(events): print '/* This file is autogenerated by tracetool, do not edit. */' =20 -def trace_stap_end(): - pass #nop, reqd for trace_gen - -def trace_d_begin(): +def trace_d_begin(events): print '/* This file is autogenerated by tracetool, do not edit. */' =20 -def trace_d_end(): - pass #nop, reqd for trace_gen - =20 # Registry of backends and their converter functions converters =3D { @@ -331,22 +320,19 @@ converters =3D { } =20 # Trace file header and footer code generators -trace_gen =3D { +formats =3D { 'h': { 'begin': trace_h_begin, 'end': trace_h_end, }, 'c': { 'begin': trace_c_begin, - 'end': trace_c_end, }, 'd': { 'begin': trace_d_begin, - 'end': trace_d_end, }, 'stap': { 'begin': trace_stap_begin, - 'end': trace_stap_end, }, } =20 @@ -488,10 +474,12 @@ def main(): =20 events =3D read_events(sys.stdin) =20 - trace_gen[output]['begin']() + if 'begin' in formats[output]: + formats[output]['begin'](events) converters[backend][output]([ e for e in events if 'disable' not in = e.properties ]) converters['nop'][output]([ e for e in events if 'disable' in e.prop= erties ]) - trace_gen[output]['end']() + if 'end' in formats[output]: + formats[output]['end'](events) =20 if __name__ =3D=3D "__main__": main()