From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: kwolf@redhat.com, michael.roth@amd.com, qemu-devel@nongnu.org,
hreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com,
jsnow@redhat.com
Subject: Re: [PATCH v3 1/3] scripts/qapi/gen.py: add .trace-events file for module
Date: Tue, 18 Jan 2022 09:38:05 +0100 [thread overview]
Message-ID: <87y23dphg2.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20220117201845.2438382-2-vsementsov@virtuozzo.com> (Vladimir Sementsov-Ogievskiy's message of "Mon, 17 Jan 2022 21:18:43 +0100")
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:
> We are going to generate trace events for qmp commands. We should
> generate both trace events and trace-events.
What do you mean to say with the second sentence? "trace events" == the
calls of generated trace_FOO(), and "trace-events" == the input file for
tracetool?
> For now, add .trace-events file object, to be filled in further commit.
What is a file object? See below.
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> scripts/qapi/gen.py | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
> index 995a97d2b8..605b3fe68a 100644
> --- a/scripts/qapi/gen.py
> +++ b/scripts/qapi/gen.py
> @@ -251,7 +251,7 @@ def __init__(self,
> self._builtin_blurb = builtin_blurb
> self._pydoc = pydoc
> self._current_module: Optional[str] = None
> - self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH]] = {}
> + self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH, QAPIGen]] = {}
> self._main_module: Optional[str] = None
>
> @property
> @@ -264,6 +264,11 @@ def _genh(self) -> QAPIGenH:
> assert self._current_module is not None
> return self._module[self._current_module][1]
>
> + @property
> + def _gent(self) -> QAPIGen:
> + assert self._current_module is not None
> + return self._module[self._current_module][2]
> +
> @staticmethod
> def _module_dirname(name: str) -> str:
> if QAPISchemaModule.is_user_module(name):
> @@ -293,7 +298,8 @@ def _add_module(self, name: str, blurb: str) -> None:
> basename = self._module_filename(self._what, name)
> genc = QAPIGenC(basename + '.c', blurb, self._pydoc)
> genh = QAPIGenH(basename + '.h', blurb, self._pydoc)
> - self._module[name] = (genc, genh)
> + gent = QAPIGen(basename + '.trace-events')
Aha. You're adding an output module FOO.trace-events for schema module
FOO.
We commonly use a single trace-events per directory, but I believe your
choice of one per module is simpler for the QAPI generator, and just
fine for tracing.
Please add
class QAPIGenTrace(QAPIGen):
def _top(self, fname):
return (QAPIGen._top(self, fname)
+ '# AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n')
> + self._module[name] = (genc, genh, gent)
> self._current_module = name
>
> @contextmanager
> @@ -304,11 +310,12 @@ def _temp_module(self, name: str) -> Iterator[None]:
> self._current_module = old_module
>
> def write(self, output_dir: str, opt_builtins: bool = False) -> None:
> - for name, (genc, genh) in self._module.items():
> + for name, (genc, genh, gent) in self._module.items():
> if QAPISchemaModule.is_builtin_module(name) and not opt_builtins:
> continue
> genc.write(output_dir)
> genh.write(output_dir)
> + gent.write(output_dir)
>
> def _begin_builtin_module(self) -> None:
> pass
next prev parent reply other threads:[~2022-01-18 8:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 20:18 [PATCH v3 0/3] trace qmp commands Vladimir Sementsov-Ogievskiy
2022-01-17 20:18 ` [PATCH v3 1/3] scripts/qapi/gen.py: add .trace-events file for module Vladimir Sementsov-Ogievskiy
2022-01-18 8:38 ` Markus Armbruster [this message]
2022-01-18 10:34 ` Vladimir Sementsov-Ogievskiy
2022-01-17 20:18 ` [PATCH v3 2/3] scripts/qapi-gen.py: add --add-trace-events option Vladimir Sementsov-Ogievskiy
2022-01-18 10:27 ` Markus Armbruster
2022-01-18 11:58 ` Vladimir Sementsov-Ogievskiy
2022-01-18 14:22 ` Markus Armbruster
2022-01-19 8:41 ` Paolo Bonzini
2022-01-17 20:18 ` [PATCH v3 3/3] meson: generate trace events for qmp commands Vladimir Sementsov-Ogievskiy
2022-01-18 10:30 ` Markus Armbruster
2022-01-18 12:21 ` Paolo Bonzini
2022-01-18 13:05 ` Markus Armbruster
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=87y23dphg2.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.