From: Beau Belgrave <beaub@linux.microsoft.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Yordan Karadzhov <y.karadz@gmail.com>, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v1 1/3] libtracefs: Add user_events to libtracefs sources
Date: Tue, 22 Feb 2022 08:59:46 -0800 [thread overview]
Message-ID: <20220222165946.GA1709@kbox> (raw)
In-Reply-To: <20220222090021.3f2ba377@rorschach.local.home>
On Tue, Feb 22, 2022 at 09:00:21AM -0500, Steven Rostedt wrote:
> On Tue, 22 Feb 2022 08:27:31 +0200
> Yordan Karadzhov <y.karadz@gmail.com> wrote:
>
> > I have one last question. Do you consider as a valid use case that
> > the library must support, someone to do a just 'test" without writing
> > after this, or to "write" without testing first?
>
> Actually, that's a very good point.
>
> I was thinking that I didn't like the "test" name, and was thinking of
> having it be:
>
> if (tracefs_user_event_enabled(event)) {
> tracefs_user_event_record(event, ...);
> }
I do like the renaming of test to enabled and write to record.
>
> But I think you have a good point. Perhaps we should just have:
>
> tracefs_user_event_trace(event, ...);
>
> and it do all the work. But it would need to be a macro, that does:
>
> #define tracefs_user_event_trace(event, ...) \
> do { \
> if (tracefs_user_event_enabled(event)) { \
> tracefs_user_event_record(event, ##__VA_ARGS); \
> } \
> } while (0)
>
> Because we do not want to have the compiler process the arguments when
> the event is not enabled. That would be too much overhead.
>
> But as a macro, it would work.
>
> Thoughts?
Many times we have found that we have to do work that should only be
performed if the event is enabled. As long as there is a still clear
ways to check without the macro, this would be fine with me.
IE: strlen(message)
We should not walk strings unless the event is enabled.
Thanks,
-Beau
next prev parent reply other threads:[~2022-02-22 16:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 22:50 [PATCH v1 0/3] libtracefs: Add APIs for user_events to libtracefs Beau Belgrave
2022-02-18 22:50 ` [PATCH v1 1/3] libtracefs: Add user_events to libtracefs sources Beau Belgrave
2022-02-21 11:34 ` Yordan Karadzhov
2022-02-21 17:57 ` Beau Belgrave
2022-02-21 19:16 ` Steven Rostedt
2022-02-22 6:27 ` Yordan Karadzhov
2022-02-22 14:00 ` Steven Rostedt
2022-02-22 14:25 ` Yordan Karadzhov
2022-02-22 15:41 ` Steven Rostedt
2022-02-22 16:59 ` Beau Belgrave [this message]
2022-02-22 17:10 ` Steven Rostedt
2022-02-22 17:08 ` Steven Rostedt
2022-02-22 17:31 ` Steven Rostedt
2022-02-22 17:39 ` Steven Rostedt
2022-02-22 17:46 ` Beau Belgrave
2022-02-22 18:59 ` Steven Rostedt
2022-02-18 22:50 ` [PATCH v1 2/3] libtracefs: Add documentation and sample code for user_events Beau Belgrave
2022-02-18 22:50 ` [PATCH v1 3/3] libtracefs: Add unit tests " Beau Belgrave
2022-02-22 17:20 ` Steven Rostedt
2022-02-22 17:34 ` [PATCH v1 0/3] libtracefs: Add APIs for user_events to libtracefs Steven Rostedt
2022-02-22 17:50 ` Beau Belgrave
2022-02-22 18:20 ` Steven Rostedt
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=20220222165946.GA1709@kbox \
--to=beaub@linux.microsoft.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=y.karadz@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).