From: Stefan Hajnoczi <stefanha@redhat.com>
To: Tanish Desai <tanishdesai37@gmail.com>
Cc: qemu-devel@nongnu.org, Mads Ynddal <mads@ynddal.dk>
Subject: Re: [PATCH v2 2/3] tracetool: introduce generate_unconditional
Date: Tue, 24 Jun 2025 10:37:01 -0400 [thread overview]
Message-ID: <20250624143701.GA5519@fedora> (raw)
In-Reply-To: <20250620143720.3143-3-tanishdesai37@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1724 bytes --]
On Fri, Jun 20, 2025 at 02:37:19PM +0000, Tanish Desai wrote:
> diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
> index ea126b07ea..89d54b9aff 100644
> --- a/scripts/tracetool/format/h.py
> +++ b/scripts/tracetool/format/h.py
> @@ -76,13 +76,17 @@ def generate(events, backend, group):
> out('',
> 'static inline void %(api)s(%(args)s)',
> '{',
> - ' if (%(cond)s) {',
> + api=e.api(),
> + args=e.args)
> +
> + if "disable" not in e.properties:
> + backend.generate_unconditional(e, group)
> +
> + out(' if (%(cond)s) {',
> ' %(api_nocheck)s(%(names)s);',
> ' }',
> '}',
> - api=e.api(),
> api_nocheck=e.api(e.QEMU_TRACE_NOCHECK),
> - args=e.args,
> names=", ".join(e.args.names()),
> cond=cond)
Two thoughts:
1. nocheck isn't necessary anymore. The body of nocheck could be inlined
here instead to simplify the generated code.
2. "if (%(cond)s) {" is only useful for backends that implement
.generate(). For example, if only the dtrace backend is enabled then
"if (trace_event_get_state(...)) {}" will be emitted unnecessarily.
Maybe backends should have a .condition() interface so that
scripts/tracetool/format/h.py:generate() can first collect a dict[cond]
-> backend. Then it iterates over the map, calling backend.generate()
within "if (%(cond)s) { ... }". That way only the conditions that are
actually needed are generated and multiple backends that have the same
condition will share the same if statement.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-06-24 14:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 14:37 [PATCH v2 0/3] tracetool: cleanup "if(true)" check from trace_foo() Tanish Desai
2025-06-20 14:37 ` [PATCH v2 1/3] tracetool: removed the unused vcpu property Tanish Desai
2025-06-20 16:12 ` Alex Bennée
2025-06-20 16:27 ` Tanish Desai
2025-06-20 14:37 ` [PATCH v2 2/3] tracetool: introduce generate_unconditional Tanish Desai
2025-06-24 14:37 ` Stefan Hajnoczi [this message]
2025-06-24 17:37 ` Tanish Desai
2025-06-24 19:03 ` Stefan Hajnoczi
2025-06-25 12:30 ` [PATCH v3] tracetool: generates conitional checks when needed Tanish Desai
2025-06-26 18:43 ` Stefan Hajnoczi
2025-06-26 19:30 ` Tanish Desai
2025-06-20 14:37 ` [PATCH v2 3/3] tracetool: remove redundant event_get_state checks Tanish Desai
2025-06-24 14:26 ` Stefan Hajnoczi
2025-06-20 14:38 ` [PATCH v2 0/3] tracetool: cleanup "if(true)" check from trace_foo() Tanish Desai
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=20250624143701.GA5519@fedora \
--to=stefanha@redhat.com \
--cc=mads@ynddal.dk \
--cc=qemu-devel@nongnu.org \
--cc=tanishdesai37@gmail.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).