From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkWCH-0001Bx-BJ for qemu-devel@nongnu.org; Thu, 15 Sep 2016 08:55:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkWCE-0005lP-At for qemu-devel@nongnu.org; Thu, 15 Sep 2016 08:55:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkWCE-0005lC-1s for qemu-devel@nongnu.org; Thu, 15 Sep 2016 08:55:18 -0400 Date: Thu, 15 Sep 2016 13:55:14 +0100 From: "Daniel P. Berrange" Message-ID: <20160915125514.GO26068@redhat.com> Reply-To: "Daniel P. Berrange" References: <147388819720.17002.17020698136656908126.stgit@fimbulvetr.bsc.es> <147388821876.17002.6684458103246806554.stgit@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <147388821876.17002.6684458103246806554.stgit@fimbulvetr.bsc.es> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 4/4] trace: [tcg] Do not generate TCG code to trace dinamically-disabled events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?B?TGx1w61z?= Vilanova Cc: qemu-devel@nongnu.org, Eduardo Habkost , Stefan Hajnoczi On Wed, Sep 14, 2016 at 11:23:38PM +0200, Llu=C3=ADs Vilanova wrote: > If an event is dynamically disabled, the TCG code that calls the > execution-time tracer is not generated. >=20 > Removes the overheads of execution-time tracers for dynamically disable= d > events. As a bonus, also avoids checking the event state when the > execution-time tracer is called from TCG-generated code (since otherwis= e > TCG would simply not call it). >=20 > Signed-off-by: Llu=C3=ADs Vilanova > --- > scripts/tracetool/backend/dtrace.py | 2 +- > scripts/tracetool/backend/ftrace.py | 20 ++++++++++---------- > scripts/tracetool/backend/log.py | 16 ++++++++-------- > scripts/tracetool/backend/simple.py | 2 +- > scripts/tracetool/backend/syslog.py | 6 +++--- > scripts/tracetool/backend/ust.py | 2 +- > scripts/tracetool/format/h.py | 23 +++++++++++++++++-----= - > scripts/tracetool/format/tcg_h.py | 20 +++++++++++++++++--- > scripts/tracetool/format/tcg_helper_c.py | 3 ++- > 9 files changed, 60 insertions(+), 34 deletions(-) >=20 > diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/ba= ckend/dtrace.py > index ab9ecfa..20242f2 100644 > --- a/scripts/tracetool/backend/dtrace.py > +++ b/scripts/tracetool/backend/dtrace.py > @@ -41,6 +41,6 @@ def generate_h_begin(events): > =20 > =20 > def generate_h(event): > - out(' QEMU_%(uppername)s(%(argnames)s);', > + out(' QEMU_%(uppername)s(%(argnames)s);', > uppername=3Devent.name.upper(), > argnames=3D", ".join(event.args.names())) > diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/ba= ckend/ftrace.py > index 80dcf30..d798c71 100644 > --- a/scripts/tracetool/backend/ftrace.py > +++ b/scripts/tracetool/backend/ftrace.py > @@ -30,17 +30,17 @@ def generate_h(event): > if len(event.args) > 0: > argnames =3D ", " + argnames > =20 > - out(' {', > - ' char ftrace_buf[MAX_TRACE_STRLEN];', > - ' int unused __attribute__ ((unused));', > - ' int trlen;', > - ' if (trace_event_get_state(%(event_id)s)) {', > - ' trlen =3D snprintf(ftrace_buf, MAX_TRACE_STRL= EN,', > - ' "%(name)s " %(fmt)s "\\n" %(= argnames)s);', > - ' trlen =3D MIN(trlen, MAX_TRACE_STRLEN - 1);', > - ' unused =3D write(trace_marker_fd, ftrace_buf,= trlen);', > - ' }', > + out(' {', > + ' char ftrace_buf[MAX_TRACE_STRLEN];', > + ' int unused __attribute__ ((unused));', > + ' int trlen;', > + ' if (trace_event_get_state(%(event_id)s)) {', > + ' trlen =3D snprintf(ftrace_buf, MAX_TRACE_STRLEN,'= , > + ' "%(name)s " %(fmt)s "\\n" %(argn= ames)s);', > + ' trlen =3D MIN(trlen, MAX_TRACE_STRLEN - 1);', > + ' unused =3D write(trace_marker_fd, ftrace_buf, trl= en);', > ' }', > + ' }', > name=3Devent.name, > args=3Devent.args, > event_id=3D"TRACE_" + event.name.upper(), > diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backe= nd/log.py > index b3ff064..6818147 100644 > --- a/scripts/tracetool/backend/log.py > +++ b/scripts/tracetool/backend/log.py > @@ -36,14 +36,14 @@ def generate_h(event): > else: > cond =3D "trace_event_get_state(%s)" % ("TRACE_" + event.name.= upper()) > =20 > - out(' if (%(cond)s) {', > - ' struct timeval _now;', > - ' gettimeofday(&_now, NULL);', > - ' qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)= s " %(fmt)s "\\n",', > - ' getpid(),', > - ' (size_t)_now.tv_sec, (size_t)_now.t= v_usec', > - ' %(argnames)s);', > - ' }', > + out(' if (%(cond)s) {', > + ' struct timeval _now;', > + ' gettimeofday(&_now, NULL);', > + ' qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " = %(fmt)s "\\n",', > + ' getpid(),', > + ' (size_t)_now.tv_sec, (size_t)_now.tv_us= ec', > + ' %(argnames)s);', > + ' }', > cond=3Dcond, > name=3Devent.name, > fmt=3Devent.fmt.rstrip("\n"), > diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/ba= ckend/simple.py > index 1bccada..4acf23f 100644 > --- a/scripts/tracetool/backend/simple.py > +++ b/scripts/tracetool/backend/simple.py > @@ -36,7 +36,7 @@ def generate_h_begin(events): > =20 > =20 > def generate_h(event): > - out(' _simple_%(api)s(%(args)s);', > + out(' _simple_%(api)s(%(args)s);', > api=3Devent.api(), > args=3D", ".join(event.args.names())) > =20 > diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/ba= ckend/syslog.py > index 89019bc..b355121 100644 > --- a/scripts/tracetool/backend/syslog.py > +++ b/scripts/tracetool/backend/syslog.py > @@ -36,9 +36,9 @@ def generate_h(event): > else: > cond =3D "trace_event_get_state(%s)" % ("TRACE_" + event.name.= upper()) > =20 > - out(' if (%(cond)s) {', > - ' syslog(LOG_INFO, "%(name)s " %(fmt)s %(argnames)s= );', > - ' }', > + out(' if (%(cond)s) {', > + ' syslog(LOG_INFO, "%(name)s " %(fmt)s %(argnames)s);', > + ' }', > cond=3Dcond, > name=3Devent.name, > fmt=3Devent.fmt.rstrip("\n"), > diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backe= nd/ust.py > index ed4c227..88d13e2 100644 > --- a/scripts/tracetool/backend/ust.py > +++ b/scripts/tracetool/backend/ust.py > @@ -30,6 +30,6 @@ def generate_h(event): > if len(event.args) > 0: > argnames =3D ", " + argnames > =20 > - out(' tracepoint(qemu, %(name)s%(tp_args)s);', > + out(' tracepoint(qemu, %(name)s%(tp_args)s);', > name=3Devent.name, > tp_args=3Dargnames) All the stylistic whitespace changes should be done as a separate patch from the the functional changes. Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|