2015-05-06 02:33:03

by Badhri Jagan Sridharan

[permalink] [raw]
Subject: [PATCH v2] tracing: timer: Add deferrable flag to timer_start

The timer_start event now shows whether the timer is
deferrable in case of a low-res timer. The debug_activate
function now includes deferrable flag while calling
trace_timer_start event.

Signed-off-by: Badhri Jagan Sridharan <[email protected]>
---
Changelog since v1:
- fixed indentation
- moved deferrable flag checking to tracing code

include/trace/events/timer.h | 14 +++++++++-----
kernel/time/timer.c | 3 ++-
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 68c2c20..e69bb03 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -43,15 +43,17 @@ DEFINE_EVENT(timer_class, timer_init,
*/
TRACE_EVENT(timer_start,

- TP_PROTO(struct timer_list *timer, unsigned long expires),
+ TP_PROTO(struct timer_list *timer,
+ unsigned long expires, char deferrable),

- TP_ARGS(timer, expires),
+ TP_ARGS(timer, expires, deferrable),

TP_STRUCT__entry(
__field( void *, timer )
__field( void *, function )
__field( unsigned long, expires )
__field( unsigned long, now )
+ __field( char, deferrable )
),

TP_fast_assign(
@@ -59,11 +61,13 @@ TRACE_EVENT(timer_start,
__entry->function = timer->function;
__entry->expires = expires;
__entry->now = jiffies;
+ __entry->deferrable = deferrable;
),

- TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
- __entry->timer, __entry->function, __entry->expires,
- (long)__entry->expires - __entry->now)
+ TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld] defer=%c",
+ __entry->timer, __entry->function, __entry->expires,
+ (long)__entry->expires - __entry->now,
+ __entry->deferrable > 0 ? 'y':'n')
);

/**
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 2ece3aa..e5588da 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -648,7 +648,8 @@ static inline void
debug_activate(struct timer_list *timer, unsigned long expires)
{
debug_timer_activate(timer);
- trace_timer_start(timer, expires);
+ trace_timer_start(timer, expires,
+ tbase_get_deferrable(timer->base));
}

static inline void debug_deactivate(struct timer_list *timer)
--
2.2.0.rc0.207.ga3a616c


2015-05-06 02:44:00

by Badhri Jagan Sridharan

[permalink] [raw]
Subject: Re: [PATCH v2] tracing: timer: Add deferrable flag to timer_start

Please ignore this version...
Found another inconsistency in indent.
Submitting another patch.

On 05/05/2015 07:32 PM, Badhri Jagan Sridharan wrote:
> The timer_start event now shows whether the timer is
> deferrable in case of a low-res timer. The debug_activate
> function now includes deferrable flag while calling
> trace_timer_start event.
>
> Signed-off-by: Badhri Jagan Sridharan <[email protected]>
> ---
> Changelog since v1:
> - fixed indentation
> - moved deferrable flag checking to tracing code
>
> include/trace/events/timer.h | 14 +++++++++-----
> kernel/time/timer.c | 3 ++-
> 2 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
> index 68c2c20..e69bb03 100644
> --- a/include/trace/events/timer.h
> +++ b/include/trace/events/timer.h
> @@ -43,15 +43,17 @@ DEFINE_EVENT(timer_class, timer_init,
> */
> TRACE_EVENT(timer_start,
>
> - TP_PROTO(struct timer_list *timer, unsigned long expires),
> + TP_PROTO(struct timer_list *timer,
> + unsigned long expires, char deferrable),
>
> - TP_ARGS(timer, expires),
> + TP_ARGS(timer, expires, deferrable),
>
> TP_STRUCT__entry(
> __field( void *, timer )
> __field( void *, function )
> __field( unsigned long, expires )
> __field( unsigned long, now )
> + __field( char, deferrable )
> ),
>
> TP_fast_assign(
> @@ -59,11 +61,13 @@ TRACE_EVENT(timer_start,
> __entry->function = timer->function;
> __entry->expires = expires;
> __entry->now = jiffies;
> + __entry->deferrable = deferrable;
> ),
>
> - TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
> - __entry->timer, __entry->function, __entry->expires,
> - (long)__entry->expires - __entry->now)
> + TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld] defer=%c",
> + __entry->timer, __entry->function, __entry->expires,
> + (long)__entry->expires - __entry->now,
> + __entry->deferrable > 0 ? 'y':'n')
> );
>
> /**
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 2ece3aa..e5588da 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -648,7 +648,8 @@ static inline void
> debug_activate(struct timer_list *timer, unsigned long expires)
> {
> debug_timer_activate(timer);
> - trace_timer_start(timer, expires);
> + trace_timer_start(timer, expires,
> + tbase_get_deferrable(timer->base));
> }
>
> static inline void debug_deactivate(struct timer_list *timer)
>