Skip to content

Commit

Permalink
tracing: Fix timer tracing
Browse files Browse the repository at this point in the history
PowerTOP would like to be able to trace timers.

Unfortunately, the current timer tracing is not very useful: the
actual timer function is not recorded in the trace at the start
of timer execution.

Although this is recorded for timer "start" time (when it gets
armed), this is not useful; most timers get started early, and a
tracer like PowerTOP will never see this event, but will only
see the actual running of the  timer.

This patch just adds the function to the timer tracing; I've
verified with PowerTOP that now it can get useful information
about timers.

Signed-off-by: Arjan van de Ven <[email protected]>
Cc: [email protected]
Cc: Steven Rostedt <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: <[email protected]> # .35.x, .34.x, .33.x
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
fenrus75 authored and Ingo Molnar committed Aug 19, 2010
1 parent 737480a commit ede1b42
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/trace/events/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ TRACE_EVENT(timer_expire_entry,
TP_STRUCT__entry(
__field( void *, timer )
__field( unsigned long, now )
__field( void *, function)
),

TP_fast_assign(
__entry->timer = timer;
__entry->now = jiffies;
__entry->function = timer->function;
),

TP_printk("timer=%p now=%lu", __entry->timer, __entry->now)
TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now)
);

/**
Expand Down Expand Up @@ -200,14 +202,16 @@ TRACE_EVENT(hrtimer_expire_entry,
TP_STRUCT__entry(
__field( void *, hrtimer )
__field( s64, now )
__field( void *, function)
),

TP_fast_assign(
__entry->hrtimer = hrtimer;
__entry->now = now->tv64;
__entry->function = hrtimer->function;
),

TP_printk("hrtimer=%p now=%llu", __entry->hrtimer,
TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function,
(unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
);

Expand Down

0 comments on commit ede1b42

Please sign in to comment.