[PATCH 2/3] Track basic SCMI statistics

Luke Parkin luke.parkin at arm.com
Tue Jul 2 02:57:23 PDT 2024


> 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



More information about the linux-arm-kernel mailing list