qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: christoph.seifert@posteo.de
Cc: qemu-devel@nongnu.org, stefanha@redhat.com,
	"Lluís Vilanova" <vilanova@ac.upc.edu>
Subject: Re: [Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces
Date: Mon, 17 Nov 2014 16:22:34 +0000	[thread overview]
Message-ID: <20141117162234.GJ16192@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1414964279-25288-1-git-send-email-christoph.seifert@posteo.de>

[-- Attachment #1: Type: text/plain, Size: 3923 bytes --]

On Sun, Nov 02, 2014 at 10:37:59PM +0100, christoph.seifert@posteo.de wrote:
> From: Christoph Seifert <christoph.seifert@posteo.de>
> 
> simpletrace.py does not recognize the tcg option while reading trace-events  file. In result simpletrace does not work on binary traces and tcg enabled events. Moved transformation of tcg enabled events to _read_events() which is used by simpletrace.
> 
> Signed-off-by: Christoph Seifert <christoph.seifert@posteo.de>
> ---
>  scripts/tracetool/__init__.py | 67 +++++++++++++++++++++----------------------
>  1 file changed, 33 insertions(+), 34 deletions(-)

Looks good to me.

Lluís: Any comments?

> diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
> index 3d5743f..181675f 100644
> --- a/scripts/tracetool/__init__.py
> +++ b/scripts/tracetool/__init__.py
> @@ -253,14 +253,44 @@ class Event(object):
>  
>  
>  def _read_events(fobj):
> -    res = []
> +    events = []
>      for line in fobj:
>          if not line.strip():
>              continue
>          if line.lstrip().startswith('#'):
>              continue
> -        res.append(Event.build(line))
> -    return res
> +
> +        event = Event.build(line)
> +
> +        # transform TCG-enabled events
> +        if "tcg" not in event.properties:
> +            events.append(event)
> +        else:
> +            event_trans = event.copy()
> +            event_trans.name += "_trans"
> +            event_trans.properties += ["tcg-trans"]
> +            event_trans.fmt = event.fmt[0]
> +            args_trans = []
> +            for atrans, aorig in zip(
> +                    event_trans.transform(tracetool.transform.TCG_2_HOST).args,
> +                    event.args):
> +                if atrans == aorig:
> +                    args_trans.append(atrans)
> +            event_trans.args = Arguments(args_trans)
> +            event_trans = event_trans.copy()
> +
> +            event_exec = event.copy()
> +            event_exec.name += "_exec"
> +            event_exec.properties += ["tcg-exec"]
> +            event_exec.fmt = event.fmt[1]
> +            event_exec = event_exec.transform(tracetool.transform.TCG_2_HOST)
> +
> +            new_event = [event_trans, event_exec]
> +            event.event_trans, event.event_exec = new_event
> +
> +            events.extend(new_event)
> +
> +    return events
>  
>  
>  class TracetoolError (Exception):
> @@ -333,35 +363,4 @@ def generate(fevents, format, backends,
>  
>      events = _read_events(fevents)
>  
> -    # transform TCG-enabled events
> -    new_events = []
> -    for event in events:
> -        if "tcg" not in event.properties:
> -            new_events.append(event)
> -        else:
> -            event_trans = event.copy()
> -            event_trans.name += "_trans"
> -            event_trans.properties += ["tcg-trans"]
> -            event_trans.fmt = event.fmt[0]
> -            args_trans = []
> -            for atrans, aorig in zip(
> -                    event_trans.transform(tracetool.transform.TCG_2_HOST).args,
> -                    event.args):
> -                if atrans == aorig:
> -                    args_trans.append(atrans)
> -            event_trans.args = Arguments(args_trans)
> -            event_trans = event_trans.copy()
> -
> -            event_exec = event.copy()
> -            event_exec.name += "_exec"
> -            event_exec.properties += ["tcg-exec"]
> -            event_exec.fmt = event.fmt[1]
> -            event_exec = event_exec.transform(tracetool.transform.TCG_2_HOST)
> -
> -            new_event = [event_trans, event_exec]
> -            event.event_trans, event.event_exec = new_event
> -
> -            new_events.extend(new_event)
> -    events = new_events
> -
>      tracetool.format.generate(events, format, backend)
> -- 
> 2.1.3
> 
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-11-17 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-02 21:37 [Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces christoph.seifert
2014-11-17 16:22 ` Stefan Hajnoczi [this message]
2014-11-18  1:57   ` Lluís Vilanova
2014-11-18 14:05     ` Stefan Hajnoczi
2014-11-18 14:07 ` 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=20141117162234.GJ16192@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=christoph.seifert@posteo.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /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).