From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com,
vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com,
kwolf@redhat.com, pbonzini@redhat.com
Subject: [PATCH v3 1/3] scripts/qapi/gen.py: add .trace-events file for module
Date: Mon, 17 Jan 2022 21:18:43 +0100 [thread overview]
Message-ID: <20220117201845.2438382-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20220117201845.2438382-1-vsementsov@virtuozzo.com>
We are going to generate trace events for qmp commands. We should
generate both trace events and trace-events.
For now, add .trace-events file object, to be filled in further commit.
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')
+ 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
--
2.31.1
next prev parent reply other threads:[~2022-01-17 20:36 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 ` Vladimir Sementsov-Ogievskiy [this message]
2022-01-18 8:38 ` [PATCH v3 1/3] scripts/qapi/gen.py: add .trace-events file for module Markus Armbruster
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=20220117201845.2438382-2-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=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 \
/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).