Revisão | ff8e4827adb08b3db5ee5faacf4822a7b84b91be (tree) |
---|---|
Hora | 2022-01-27 23:16:28 |
Autor | Vladimir Sementsov-Ogievskiy <vsementsov@virt...> |
Commiter | Markus Armbruster |
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>
@@ -1630,6 +1630,9 @@ The following files are generated: | ||
1630 | 1630 | ``$(prefix)qapi-commands.h`` |
1631 | 1631 | Function prototypes for the QMP commands specified in the schema |
1632 | 1632 | |
1633 | + ``$(prefix)qapi-commands.trace-events`` | |
1634 | + Trace event declarations, see :ref:`tracing`. | |
1635 | + | |
1633 | 1636 | ``$(prefix)qapi-init-commands.h`` |
1634 | 1637 | Command initialization prototype |
1635 | 1638 |
@@ -1650,6 +1653,13 @@ Example:: | ||
1650 | 1653 | void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp); |
1651 | 1654 | |
1652 | 1655 | #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 | + | |
1653 | 1663 | $ cat qapi-generated/example-qapi-commands.c |
1654 | 1664 | [Uninteresting stuff omitted...] |
1655 | 1665 |
@@ -1689,14 +1699,27 @@ Example:: | ||
1689 | 1699 | goto out; |
1690 | 1700 | } |
1691 | 1701 | |
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 | + | |
1692 | 1708 | retval = qmp_my_command(arg.arg1, &err); |
1693 | 1709 | if (err) { |
1710 | + trace_qmp_exit_my_command(error_get_pretty(err), false); | |
1694 | 1711 | error_propagate(errp, err); |
1695 | 1712 | goto out; |
1696 | 1713 | } |
1697 | 1714 | |
1698 | 1715 | qmp_marshal_output_UserDefOne(retval, ret, errp); |
1699 | 1716 | |
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 | + | |
1700 | 1723 | out: |
1701 | 1724 | visit_free(v); |
1702 | 1725 | v = qapi_dealloc_visitor_new(); |
@@ -1,3 +1,5 @@ | ||
1 | +.. _tracing: | |
2 | + | |
1 | 3 | ======= |
2 | 4 | Tracing |
3 | 5 | ======= |