[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <490bb053-f2dd-4c6a-a976-c8d21d66eb4c@arm.com>
Date: Tue, 2 Jul 2024 10:57:23 +0100
From: Luke Parkin <luke.parkin@....com>
To: Cristian Marussi <cristian.marussi@....com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"arm-scmi@...r.kernel.org" <arm-scmi@...r.kernel.org>,
Sudeep Holla <Sudeep.Holla@....com>
Subject: Re: [PATCH 2/3] Track basic SCMI statistics
> Ok, so IMO, this is the main core thing to rework in this series: the
> "counting" operation/block should be defined as a macro so that it can
> be fully compiled out when STATS=n, because these are counters
> incremented on the hot path for each message, not just once in a while,
> so the above if(IS_ENABELD()) now will be there and evaluated even when
> STATS=n.
>
> Something like:
>
> #ifdef CONFIG_ARM_SCMI_DEBUG_STATISTICS
> #define SCMI_LOG_STATS(counter) \
> <your magic here> \
> #else
> #define SCMI_LOG_STATS(counter)
> #endif
>
> .... I have not thought it through eh...so it could be radically
> different...the point is ... the counting machinery should just
> disappear at compile time when STATS=n
Hey Cristian, Unless I've missed something, It looks like IS_ENABLED() does do
what you ask for.
In Documentation/process/coding-style.rst:1168 it reccomends using IS_ENABLED
for conditional compilation over #if and #ifdef, saying that the compiler will
constant-fold the conditional away.
Thanks,
Luke
Powered by blists - more mailing lists