• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版ff8e4827adb08b3db5ee5faacf4822a7b84b91be (tree)
时间2022-01-27 23:16:28
作者Vladimir Sementsov-Ogievskiy <vsementsov@virt...>
CommiterMarkus Armbruster

Log Message

docs/qapi-code-gen: update to cover trace events code generation

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>
Message-Id: <20220126161130.3240892-6-vsementsov@virtuozzo.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>

更改概述

差异

--- a/docs/devel/qapi-code-gen.rst
+++ b/docs/devel/qapi-code-gen.rst
@@ -1630,6 +1630,9 @@ The following files are generated:
16301630 ``$(prefix)qapi-commands.h``
16311631 Function prototypes for the QMP commands specified in the schema
16321632
1633+ ``$(prefix)qapi-commands.trace-events``
1634+ Trace event declarations, see :ref:`tracing`.
1635+
16331636 ``$(prefix)qapi-init-commands.h``
16341637 Command initialization prototype
16351638
@@ -1650,6 +1653,13 @@ Example::
16501653 void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
16511654
16521655 #endif /* EXAMPLE_QAPI_COMMANDS_H */
1656+
1657+ $ cat qapi-generated/example-qapi-commands.trace-events
1658+ # AUTOMATICALLY GENERATED, DO NOT MODIFY
1659+
1660+ qmp_enter_my_command(const char *json) "%s"
1661+ qmp_exit_my_command(const char *result, bool succeeded) "%s %d"
1662+
16531663 $ cat qapi-generated/example-qapi-commands.c
16541664 [Uninteresting stuff omitted...]
16551665
@@ -1689,14 +1699,27 @@ Example::
16891699 goto out;
16901700 }
16911701
1702+ if (trace_event_get_state_backends(TRACE_QMP_ENTER_MY_COMMAND)) {
1703+ g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args));
1704+
1705+ trace_qmp_enter_my_command(req_json->str);
1706+ }
1707+
16921708 retval = qmp_my_command(arg.arg1, &err);
16931709 if (err) {
1710+ trace_qmp_exit_my_command(error_get_pretty(err), false);
16941711 error_propagate(errp, err);
16951712 goto out;
16961713 }
16971714
16981715 qmp_marshal_output_UserDefOne(retval, ret, errp);
16991716
1717+ if (trace_event_get_state_backends(TRACE_QMP_EXIT_MY_COMMAND)) {
1718+ g_autoptr(GString) ret_json = qobject_to_json(*ret);
1719+
1720+ trace_qmp_exit_my_command(ret_json->str, true);
1721+ }
1722+
17001723 out:
17011724 visit_free(v);
17021725 v = qapi_dealloc_visitor_new();
--- a/docs/devel/tracing.rst
+++ b/docs/devel/tracing.rst
@@ -1,3 +1,5 @@
1+.. _tracing:
2+
13 =======
24 Tracing
35 =======