[Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces
From: Christoph Seifert 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 --- scripts/tracetool/__init__.py | 67 +-- 1 file changed, 33 insertions(+), 34 deletions(-) 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
Re: [Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces
On Sun, Nov 02, 2014 at 10:37:59PM +0100, christoph.seif...@posteo.de wrote: > From: Christoph Seifert > > 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 > --- > 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 > > pgpVcJQLV0gqx.pgp Description: PGP signature
Re: [Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces
Stefan Hajnoczi writes: > On Sun, Nov 02, 2014 at 10:37:59PM +0100, christoph.seif...@posteo.de wrote: >> From: Christoph Seifert >> >> 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 >> --- >> scripts/tracetool/__init__.py | 67 >> +-- >> 1 file changed, 33 insertions(+), 34 deletions(-) > Looks good to me. > Lluís: Any comments? I've looked at how it affects some patches I did not have time yet to send, and everything looks good. >> 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 >> >> -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth
Re: [Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces
On Mon, Nov 17, 2014 at 07:57:08PM -0600, Lluís Vilanova wrote: > Stefan Hajnoczi writes: > > > On Sun, Nov 02, 2014 at 10:37:59PM +0100, christoph.seif...@posteo.de wrote: > >> From: Christoph Seifert > >> > >> 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 > >> --- > >> scripts/tracetool/__init__.py | 67 > >> +-- > >> 1 file changed, 33 insertions(+), 34 deletions(-) > > > Looks good to me. > > > Lluís: Any comments? > > I've looked at how it affects some patches I did not have time yet to send, > and > everything looks good. Fantastic, thanks for your time, Lluís! Stefan pgpVCTHO1OlEy.pgp Description: PGP signature
Re: [Qemu-devel] [PATCH] Tracing: Fix simpletrace.py error on tcg enabled binary traces
On Sun, Nov 02, 2014 at 10:37:59PM +0100, christoph.seif...@posteo.de wrote: > From: Christoph Seifert > > 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 > --- > scripts/tracetool/__init__.py | 67 > +-- > 1 file changed, 33 insertions(+), 34 deletions(-) Thanks, applied to my tracing tree: https://github.com/stefanha/qemu/commits/tracing Stefan pgpZe1fWea7WZ.pgp Description: PGP signature