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 v5 5/7] docs/qapi-code-gen: update to cover trace events code generation
Date: Tue, 25 Jan 2022 22:56:53 +0100 [thread overview]
Message-ID: <20220125215655.3111881-6-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20220125215655.3111881-1-vsementsov@virtuozzo.com>
Previous commits enabled trace events generation for most of QAPI
generated code (except for tests/ and qga/). Let's update documentation
to illustrate it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
docs/devel/qapi-code-gen.rst | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst
index feafed79b5..a3430740bd 100644
--- a/docs/devel/qapi-code-gen.rst
+++ b/docs/devel/qapi-code-gen.rst
@@ -1619,7 +1619,10 @@ Code generated for commands
These are the marshaling/dispatch functions for the commands defined
in the schema. The generated code provides qmp_marshal_COMMAND(), and
-declares qmp_COMMAND() that the user must implement.
+declares qmp_COMMAND() that the user must implement. The generated code
+contains trace events code. Corresponding .trace-events file with list
+of trace events is generated too, and should be parsed by trace generator
+later to generate trace event code, see `tracing <tracing.html>`.
The following files are generated:
@@ -1630,6 +1633,9 @@ The following files are generated:
``$(prefix)qapi-commands.h``
Function prototypes for the QMP commands specified in the schema
+ ``$(prefix)qapi-commands.trace-events``
+ Trace events file for trace generator, see `tracing <tracing.html>`.
+
``$(prefix)qapi-init-commands.h``
Command initialization prototype
@@ -1689,14 +1695,27 @@ Example::
goto out;
}
+ if (trace_event_get_state_backends(TRACE_QMP_ENTER_MY_COMMAND)) {
+ g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args));
+
+ trace_qmp_enter_my_command(req_json->str);
+ }
+
retval = qmp_my_command(arg.arg1, &err);
if (err) {
+ trace_qmp_exit_my_command(error_get_pretty(err), false);
error_propagate(errp, err);
goto out;
}
qmp_marshal_output_UserDefOne(retval, ret, errp);
+ if (trace_event_get_state_backends(TRACE_QMP_EXIT_MY_COMMAND)) {
+ g_autoptr(GString) ret_json = qobject_to_json(*ret);
+
+ trace_qmp_exit_my_command(ret_json->str, true);
+ }
+
out:
visit_free(v);
v = qapi_dealloc_visitor_new();
--
2.31.1
next prev parent reply other threads:[~2022-01-25 22:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 21:56 [PATCH v5 0/7] trace qmp commands Vladimir Sementsov-Ogievskiy
2022-01-25 21:56 ` [PATCH v5 1/7] scripts/qapi/gen.py: add FOO.trace-events output module Vladimir Sementsov-Ogievskiy
2022-01-26 13:20 ` Stefan Hajnoczi
2022-01-26 14:32 ` Markus Armbruster
2022-01-26 14:03 ` Markus Armbruster
2022-01-25 21:56 ` [PATCH v5 2/7] qapi/commands: refactor error handling code Vladimir Sementsov-Ogievskiy
2022-01-25 21:56 ` [PATCH v5 3/7] qapi/commands: Optionally generate trace for QMP commands Vladimir Sementsov-Ogievskiy
2022-01-26 14:03 ` Markus Armbruster
2022-01-25 21:56 ` [PATCH v5 4/7] meson: generate trace events for qmp commands Vladimir Sementsov-Ogievskiy
2022-01-25 21:56 ` Vladimir Sementsov-Ogievskiy [this message]
2022-01-26 14:24 ` [PATCH v5 5/7] docs/qapi-code-gen: update to cover trace events code generation Markus Armbruster
2022-01-25 21:56 ` [PATCH v5 6/7] meson: document, why we don't generate trace events for tests/ and qga/ Vladimir Sementsov-Ogievskiy
2022-01-26 13:33 ` Stefan Hajnoczi
2022-01-26 13:34 ` Stefan Hajnoczi
2022-01-26 14:04 ` Markus Armbruster
2022-01-25 21:56 ` [PATCH v5 7/7] qapi: generate trace events by default Vladimir Sementsov-Ogievskiy
2022-01-26 14:04 ` Markus Armbruster
2022-01-26 13:35 ` [PATCH v5 0/7] trace qmp commands Stefan Hajnoczi
2022-01-26 14:33 ` 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=20220125215655.3111881-6-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).