From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvoya-0003Vm-Lh for qemu-devel@nongnu.org; Fri, 10 Feb 2012 06:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvoyU-0001UZ-5s for qemu-devel@nongnu.org; Fri, 10 Feb 2012 06:49:16 -0500 Received: from gw.ac.upc.edu ([147.83.30.3]:55437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvoyT-0001UK-Tz for qemu-devel@nongnu.org; Fri, 10 Feb 2012 06:49:10 -0500 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Fri, 10 Feb 2012 12:49:01 +0100 Message-ID: <20120210114901.5104.60007.stgit@ginnungagap.bsc.es> In-Reply-To: <20120210114849.5104.63589.stgit@ginnungagap.bsc.es> References: <20120210114849.5104.63589.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 02/11] trace: [tracetool] Do not rebuild event list in backend code 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 Signed-off-by: Llu=C3=ADs Vilanova --- scripts/tracetool.py | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/tracetool.py b/scripts/tracetool.py index f0d7e1e..7042728 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -171,15 +171,14 @@ def simple_c(events): print print 'TraceEvent trace_list[] =3D {' print - eventlist =3D list(events) - for event in eventlist: + for event in events: print '{.tp_name =3D "%(name)s", .state=3D0},' % { 'name': event.name } print print '};' print - for event in eventlist: + for event in events: argc =3D event.argc print '''void trace_%(name)s(%(args)s) { @@ -311,8 +310,7 @@ def ust_c(events): #undef inline #undef wmb #include "trace.h"''' - eventlist =3D list(events) - for event in eventlist: + for event in events: argnames =3D event.argnames if event.argc > 0: argnames =3D ', ' + event.argnames @@ -344,7 +342,7 @@ static void ust_%(name)s_probe(%(args)s) print ''' static void __attribute__((constructor)) trace_init(void) {''' - for event in eventlist: + for event in events: print ' register_trace_ust_%(name)s(ust_%(name)s_probe);' % { 'name': event.name } @@ -510,14 +508,16 @@ class Event(object): =20 # Generator that yields Event objects given a trace-events file object def read_events(fobj): + res =3D [] event_num =3D 0 for line in fobj: if not line.strip(): continue if line.lstrip().startswith('#'): continue - yield Event(event_num, line) + res.append(Event(event_num, line)) event_num +=3D 1 + return res =20 backend =3D "" output =3D ""