On Fri,  9 Apr 2021 21:10:29 +0300
"Yordan Karadzhov (VMware)" <y.kar...@gmail.com> wrote:

> @@ -342,6 +342,12 @@ FTRACE_ENTRY(hwlat, hwlat_entry,
>  #define FUNC_REPEATS_GET_DELTA_TS(entry)                     \
>  (((u64)entry->top_delta_ts << 32) | entry->bottom_delta_ts)  \
>  
> +#define FUNC_REPEATS_SET_DELTA_TS(entry, delta)                      \
> +     do {                                                    \
> +             entry->bottom_delta_ts = delta & U32_MAX;       \
> +             entry->top_delta_ts = (delta >> 32);            \
> +     } while (0);                                            \
> +

This needs the parenthesis around the parameters as well.

Or just make it into a static inline function. The GET_DELTA_TS is used in
printing to of the event for user space where it makes sense to have it as
a macro (it will be expanded in the "print fmt" of the format file for the
event). But the setting doesn't have that limitation.

static inline void
func_repeats_set_delta_ts(struct func_repeats_entry *entry,
                          unsigned long long delta)
{
        entry->bottom_delta_ts = delta & U32_MAX;
        entry->top_delta_ts = (delta >> 32);
}

And then you can have the compiler type check everything for you. Macros
are nasty when it comes to build errors.

-- Steve


>  FTRACE_ENTRY(func_repeats, func_repeats_entry,
>  
>       TRACE_FUNC_REPEATS,
> -- 

Reply via email to