From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W348D-0008U2-VK for qemu-devel@nongnu.org; Tue, 14 Jan 2014 08:34:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W348A-0002Hj-3E for qemu-devel@nongnu.org; Tue, 14 Jan 2014 08:34:13 -0500 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]:45396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3489-0002Hf-Nt for qemu-devel@nongnu.org; Tue, 14 Jan 2014 08:34:10 -0500 Received: by mail-pa0-f41.google.com with SMTP id fb1so7558751pad.0 for ; Tue, 14 Jan 2014 05:34:08 -0800 (PST) Date: Tue, 14 Jan 2014 21:33:53 +0800 From: Stefan Hajnoczi Message-ID: <20140114133353.GA2995@stefanha-thinkpad> References: <1382661967-23561-1-git-send-email-mohamad.gebai@polymtl.ca> <1382661967-23561-3-git-send-email-mohamad.gebai@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1382661967-23561-3-git-send-email-mohamad.gebai@polymtl.ca> Subject: Re: [Qemu-devel] [PATCH v5 2/5] Modified the tracetool framework for LTTng 2.x List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mohamad Gebai Cc: Mohamad Gebai , alex.bennee@linaro.org, qemu-devel@nongnu.org On Thu, Oct 24, 2013 at 08:46:04PM -0400, Mohamad Gebai wrote: > * A new format is required to generate definitions for ust tracepoints. > Files ust_events_h.py and ust_events_c.py define common macros, while > new function ust_events_h in events.py does the actual definition of > each tracepoint. > * ust.py generates the new interface for calling userspace tracepoints > with LTTng 2.x, replacing trace_name(args) to tracepoint(name, args). > * As explained in ust_events_c.py, -Wredundant-decls gives a warning > when compiling with gcc 4.7 or older. This is specific to lttng-ust so > for now use a pragma clause to avoid getting a warning. > > Signed-off-by: Mohamad Gebai > Reviewed-by: Alex Bennée > --- > scripts/tracetool/backend/events.py | 44 +++++++++++++++++ > scripts/tracetool/backend/ust.py | 82 +++++++------------------------- > scripts/tracetool/format/ust_events_c.py | 30 ++++++++++++ > scripts/tracetool/format/ust_events_h.py | 57 ++++++++++++++++++++++ > 4 files changed, 147 insertions(+), 66 deletions(-) > create mode 100644 scripts/tracetool/format/ust_events_c.py > create mode 100644 scripts/tracetool/format/ust_events_h.py I tried to understand why the extra ust .c and .h are needed. It seems they are really part of how LTTng 2.0+ works by #including your header back from its header (?!). So I'm okay with this. > +def ust_events_h(events): > + for e in events: > + if len(e.args) > 0: > + out('TRACEPOINT_EVENT(', > + ' qemu,', > + ' %(name)s,', > + ' TP_ARGS(%(args)s),', > + ' TP_FIELDS(', > + name = e.name, > + args = ", ".join(", ".join(i) for i in e.args), > + ) > + > + for t,n in e.args: > + if ('int' in t) or ('long' in t) or ('unsigned' in t) or ('size_t' in t): > + out(' ctf_integer(' + t + ', ' + n + ', ' + n + ')') > + elif ('double' in t) or ('float' in t): > + out(' ctf_float(' + t + ', ' + n + ', ' + n + ')') > + elif ('char *' in t) or ('char*' in t): > + out(' ctf_string(' + n + ', ' + n + ')') > + elif ('void *' in t) or ('void*' in t): > + out(' ctf_integer_hex(unsigned long, ' + n + ', ' + n + ')') > + > + out(' )', > + ')', > + '') > + > + else: > + out('TRACEPOINT_EVENT(', > + ' qemu,', > + ' %(name)s,', > + ' TP_ARGS(void),', > + ' TP_FIELDS()', > + ')', > + '', > + name = e.name, > + ) This file is generic, it should not contain UST backend-specific code. Let the ust.py backend override ust_events_h() so the code can live there, and just leave a nop ust_events_h() in events.py. > + argnames = ", " + argnames > + > + out('static inline void trace_%(name)s(%(args)s)', > + '{', > + ' tracepoint(qemu, %(name)s%(tp_args)s);' > + '', Any reason for this empty string? > diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py > new file mode 100644 > index 0000000..71328f3 > --- /dev/null > +++ b/scripts/tracetool/format/ust_events_c.py > @@ -0,0 +1,30 @@ > +#!/usr/bin/env python > +# -*- coding: utf-8 -*- > + > +""" > +Generate .c for LTTng ust event description. > +""" > + > +__author__ = "Lluís Vilanova " > +__copyright__ = "Copyright 2012, Lluís Vilanova " Should you be the author? > +__license__ = "GPL version 2 or (at your option) any later version" > + > +__maintainer__ = "Stefan Hajnoczi" > +__email__ = "stefanha@linux.vnet.ibm.com" My email address is stefanha@redhat.com now. > +__author__ = "Lluís Vilanova " > +__copyright__ = "Copyright 2012, Lluís Vilanova " > +__license__ = "GPL version 2 or (at your option) any later version" > + > +__maintainer__ = "Stefan Hajnoczi" > +__email__ = "stefanha@linux.vnet.ibm.com" Same here.