qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Mohamad Gebai <mohamad.gebai@gmail.com>
Cc: Mohamad Gebai <mohamad.gebai@polymtl.ca>,
	alex.bennee@linaro.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 2/5] Modified the tracetool framework for LTTng 2.x
Date: Tue, 14 Jan 2014 21:33:53 +0800	[thread overview]
Message-ID: <20140114133353.GA2995@stefanha-thinkpad> (raw)
In-Reply-To: <1382661967-23561-3-git-send-email-mohamad.gebai@polymtl.ca>

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 <mohamad.gebai@polymtl.ca>
> Reviewed-by: Alex Bennée <alex@bennee.com>
> ---
>  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 <vilanova@ac.upc.edu>"
> +__copyright__  = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"

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 <vilanova@ac.upc.edu>"
> +__copyright__  = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
> +__license__    = "GPL version 2 or (at your option) any later version"
> +
> +__maintainer__ = "Stefan Hajnoczi"
> +__email__      = "stefanha@linux.vnet.ibm.com"

Same here.

  reply	other threads:[~2014-01-14 13:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-25  0:46 [Qemu-devel] [PATCH v5 0/5] Fix UST backend for LTTng 2.x Mohamad Gebai
2013-10-25  0:46 ` [Qemu-devel] [PATCH v5 1/5] Fix configure script " Mohamad Gebai
2013-10-25 13:18   ` Alex Bennée
2013-10-25 13:50     ` Mohamad Gebai
2013-10-25 14:33       ` Alex Bennée
2013-10-25 16:22         ` Mohamad Gebai
2014-01-14 13:34   ` Stefan Hajnoczi
2013-10-25  0:46 ` [Qemu-devel] [PATCH v5 2/5] Modified the tracetool framework " Mohamad Gebai
2014-01-14 13:33   ` Stefan Hajnoczi [this message]
2013-10-25  0:46 ` [Qemu-devel] [PATCH v5 3/5] Adapt Makefiles to the new LTTng ust interface Mohamad Gebai
2013-10-25  0:46 ` [Qemu-devel] [PATCH v5 4/5] Update documentation for LTTng ust tracing Mohamad Gebai
2013-10-25 11:23   ` Alex Bennée
2013-10-25  0:46 ` [Qemu-devel] [PATCH v5 5/5] Add ust generated files to .gitignore Mohamad Gebai
2013-11-04 16:41 ` [Qemu-devel] [PATCH v5 0/5] Fix UST backend for LTTng 2.x Alex Bennée
2013-12-11  1:45   ` Mohamad Gebai
2014-01-14 13:35 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140114133353.GA2995@stefanha-thinkpad \
    --to=stefanha@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=mohamad.gebai@gmail.com \
    --cc=mohamad.gebai@polymtl.ca \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).