On Thu, 20 Feb 2014, Alexey Perevalov wrote:

The subject line lacks any information in which part of the kernel you
are doing this.

> For extensibility purpose it's better to have _switch_ type mechanism
> for representing human readable CLOCKID* and HRMODE.
> 
> Signed-off-by: Alexey Perevalov <a.pereva...@samsung.com>
> ---
>  include/trace/events/timer.h |   16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
> index 68c2c20..185b2c6 100644
> --- a/include/trace/events/timer.h
> +++ b/include/trace/events/timer.h
> @@ -8,6 +8,16 @@
>  #include <linux/hrtimer.h>
>  #include <linux/timer.h>
>  
> +#define clockid_to_string(clockid)                                           
> \
> +     __print_symbolic(clockid,                                               
> \
> +                      { CLOCK_MONOTONIC,             "CLOCK_MONOTONIC" },    
> \
> +                      { CLOCK_REALTIME,              "CLOCK_REALTIME" })
> +
> +#define hrmode_to_string(hrmode)                                             
> \
> +     __print_symbolic(hrmode,                                                
> \
> +                      { HRTIMER_MODE_ABS,            "HRTIMER_MODE_ABS" },   
> \
> +                      { HRTIMER_MODE_REL,            "HRTIMER_MODE_REL" })
> +
>  DECLARE_EVENT_CLASS(timer_class,
>  
>       TP_PROTO(struct timer_list *timer),
> @@ -147,10 +157,8 @@ TRACE_EVENT(hrtimer_init,
>       ),
>  
>       TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
> -               __entry->clockid == CLOCK_REALTIME ?
> -                     "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
> -               __entry->mode == HRTIMER_MODE_ABS ?
> -                     "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
> +               clockid_to_string(__entry->clockid),
> +               hrmode_to_string(__entry->mode))
>  );
>  
>  /**
> -- 
> 1.7.9.5
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to