Re: [PATCH] Add power/gpu_frequency tracepoint.

From: Steven Rostedt
Date: Thu Aug 13 2020 - 17:22:44 EST


On Thu, 13 Aug 2020 14:03:57 -0700
Peiyong Lin <lpy@xxxxxxxxxx> wrote:

> +/**
> + * gpu_frequency - Reports frequency changes in GPU clock domains
> + * @state: New frequency (in KHz)
> + * @gpu_id: GPU clock domain
> + */
> +TRACE_EVENT(gpu_frequency,
> +
> + TP_PROTO(unsigned int state, unsigned int gpu_id),
> +
> + TP_ARGS(state, gpu_id),
> +
> + TP_STRUCT__entry(
> + __field(unsigned int, state)
> + __field(unsigned int, gpu_id)

Both of the above entries are unsigned int.

> + ),
> +
> + TP_fast_assign(
> + __entry->state = state;
> + __entry->gpu_id = gpu_id;
> + ),
> +
> + TP_printk("state=%lu gpu_id=%lu",
> + (unsigned long)__entry->state,
> + (unsigned long)__entry->gpu_id)

Why typecast to (unsigned long) to use it in %lu? Why not just have:

TP_printk("state=%u gpu_id=%u",
__entry->state, __entry->gpu_id)

?

-- Steve


> +);
> #endif /* _TRACE_POWER_H */
>
> /* This part must be outside protection */