From: "Nicholas Piggin" <npiggin@gmail.com>
To: "John Snow" <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org,
"Pavel Dovgalyuk" <Pavel.Dovgalyuk@ispras.ru>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Beraldo Leal" <bleal@redhat.com>
Subject: Re: [PATCH v2 2/4] scripts/replay-dump.py: Update to current rr record format
Date: Mon, 26 Feb 2024 16:39:51 +1000 [thread overview]
Message-ID: <CZESZCGZ5VE5.2ILQXAT261OX@wheely> (raw)
In-Reply-To: <CAFn=p-aB94Y+WSJOdHOsxmrrETy-W76KK4z1qY05QCq2dzV=zg@mail.gmail.com>
On Wed Jan 31, 2024 at 7:36 AM AEST, John Snow wrote:
> On Thu, Jan 25, 2024 at 11:09 AM Nicholas Piggin <npiggin@gmail.com> wrote:
> >
> > The v12 format support for replay-dump has a few issues still. This
> > fixes async decoding; adds event, shutdown, and end decoding; fixes
> > audio in / out events, fixes checkpoint checking of following async
> > events.
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > scripts/replay-dump.py | 132 ++++++++++++++++++++++++++++++-----------
> > 1 file changed, 98 insertions(+), 34 deletions(-)
> >
> > diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
> > index d668193e79..35732da08f 100755
> > --- a/scripts/replay-dump.py
> > +++ b/scripts/replay-dump.py
> > @@ -20,6 +20,7 @@
> >
> > import argparse
> > import struct
> > +import os
> > from collections import namedtuple
> > from os import path
> >
> > @@ -63,6 +64,10 @@ def read_byte(fin):
> > "Read a single byte"
> > return struct.unpack('>B', fin.read(1))[0]
> >
> > +def read_bytes(fin, nr):
> > + "Read a nr bytes"
>
> Existing problem in this file, but please use """triple quotes""" for
> docstrings.
Just coming back to this, sorry, was struggling a bit with ppc merge :/
> > + return fin.read(nr)
> > +
>
> Does it really save a lot of typing to alias fin.read(1) to
> read_bytes(fin, 1) ...?
Not really, I'll squash it.
>
> > def read_event(fin):
> > "Read a single byte event, but save some state"
> > if replay_state.already_read:
> > @@ -134,6 +139,18 @@ def swallow_async_qword(eid, name, dumpfile):
> > print(" %s(%d) @ %d" % (name, eid, step_id))
> > return True
> >
> > +def swallow_bytes(eid, name, dumpfile, nr):
> > + "Swallow nr bytes of data without looking at it"
> > + dumpfile.seek(nr, os.SEEK_CUR)
> > + return True
> > +
>
> Why bother returning a bool if it's not based on any condition? Add an
> error check or just drop the return value.
>
> > +def decode_exception(eid, name, dumpfile):
> > + print_event(eid, name)
> > + return True
> > +
>
> I suppose in this case, the return is to fit a common signature.
Yes that's why I did it, but it actually can't fit in the normal
decoder pattern because a nr has to be supplied as well. I'll
change it as you say.
Thanks,
Nick
next prev parent reply other threads:[~2024-02-26 6:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 16:08 [PATCH v2 0/4] replay: minor fixes and tests Nicholas Piggin
2024-01-25 16:08 ` [PATCH v2 1/4] replay: allow runstate shutdown->running when replaying trace Nicholas Piggin
2024-01-29 5:06 ` Pavel Dovgalyuk
2024-01-25 16:08 ` [PATCH v2 2/4] scripts/replay-dump.py: Update to current rr record format Nicholas Piggin
2024-01-30 21:36 ` John Snow
2024-02-26 6:39 ` Nicholas Piggin [this message]
2024-01-25 16:08 ` [PATCH v2 3/4] scripts/replay-dump.py: rejig decoders in event number order Nicholas Piggin
2024-01-25 16:08 ` [PATCH v2 4/4] tests/avocado: excercise scripts/replay-dump.py in replay tests Nicholas Piggin
2024-01-29 5:08 ` Pavel Dovgalyuk
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=CZESZCGZ5VE5.2ILQXAT261OX@wheely \
--to=npiggin@gmail.com \
--cc=Pavel.Dovgalyuk@ispras.ru \
--cc=alex.bennee@linaro.org \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=jsnow@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=wainersm@redhat.com \
/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).