Messages in this thread |  | | | Date | Mon, 28 Dec 2009 08:54:17 +0100 | | From | Ingo Molnar <> | | Subject | Re: [PATCH v2 2/5]: trace_event: export HZ in timer's tracepoint format |
| |
* Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:
> Export HZ in timer's tracepoint, we can use it to get > TIMER/ITIMER_VIRTUAL/ITIMER_PROF exact latency and it's > suggested by Ingo > > Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> > --- > include/trace/events/timer.h | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h > index 13ec15a..7749ae5 100644 > --- a/include/trace/events/timer.h > +++ b/include/trace/events/timer.h > @@ -74,14 +74,17 @@ TRACE_EVENT(timer_expire_entry, > TP_STRUCT__entry( > __field( void *, timer ) > __field( unsigned long, now ) > + __field( int, hz ) > ), > > TP_fast_assign( > __entry->timer = timer; > __entry->now = jiffies; > + __entry->hz = HZ; > ), > > - TP_printk("timer=%p now=%lu", __entry->timer, __entry->now) > + TP_printk("timer=%p now=%lu HZ=%d", __entry->timer, __entry->now, > + __entry->hz) > );
I think we can do something slightly different and more efficient: just create a new timer event to report the value of HZ.
That way we dont clutter the timer_expire_entry record format with a repetitive HZ field. It's an extra 4 bytes overhead: that has to be written, passed along, copied and thrown away in 99.9999% of the cases - such overhead should be avoided. If you created a special timer_params event, which would produce precisely one event when triggered via say a new perf ioctl. I.e. add something like this to perf_event.h:
#define PERF_EVENT_IOC_INJECT _IOW('$', 7, __u64)
and add code to kernel/perf_event.c's perf_ioctl() function that takes that __u64 parameter as an event ID and injects an 'artificial' event.
Such a new feature would be useful for other things as well: backtesting rare events, injecting other types of 'parameter/query events', etc.
There might be more details to this, but it would be a useful scheme IMO - and it would still integrate nicely with the whole ftrace event enumeration scheme so tooling support would be easier.
What do you think?
Ingo
|  |