mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Paul Mackerras <paulus@samba.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/5]: trace_event: export HZ in timer's tracepoint format
Date: Mon, 28 Dec 2009 08:54:17 +0100	[thread overview]
Message-ID: <20091228075417.GB20039@elte.hu> (raw)
In-Reply-To: <4B30C3A0.909@cn.fujitsu.com>


* 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

  parent reply	other threads:[~2009-12-28  7:54 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15 11:17 [PATCH 0/4] perf_event: introduce 'perf timer' to analyze timer's behavior Xiao Guangrong
2009-12-15 11:19 ` [PATCH 1/4] trace_event: record task' real_timer in itimer_state tracepoint Xiao Guangrong
2009-12-15 11:20   ` [PATCH 2/4] perf_event: fix getting point Xiao Guangrong
2009-12-15 11:21     ` [PATCH 3/4] perf/timer: add document Xiao Guangrong
2009-12-15 11:22       ` [PATCH 4/4] perf/timer: 'perf timer' core code Xiao Guangrong
2009-12-15 17:44         ` Thomas Gleixner
2009-12-16  5:56           ` Xiao Guangrong
2009-12-16 15:59             ` Thomas Gleixner
2009-12-17  7:26               ` Xiao Guangrong
2009-12-15 13:58     ` [PATCH 2/4] perf_event: fix getting point Frederic Weisbecker
2009-12-16  1:03       ` Xiao Guangrong
2009-12-16  1:22         ` Frederic Weisbecker
2009-12-16  1:32           ` Xiao Guangrong
2009-12-15 14:15 ` [PATCH 0/4] perf_event: introduce 'perf timer' to analyze timer's behavior Frederic Weisbecker
2009-12-16  1:19   ` Xiao Guangrong
2009-12-16  7:32     ` Ingo Molnar
2009-12-16  7:40       ` Xiao Guangrong
2009-12-16  7:46         ` Ingo Molnar
2009-12-15 14:23 ` Frederic Weisbecker
2009-12-22 13:00   ` [PATCH v2 0/5] " Xiao Guangrong
2009-12-22 13:01     ` [PATCH v2 1/5] perf_event: fix getting point Xiao Guangrong
2009-12-22 13:03     ` [PATCH v2 2/5]: trace_event: export HZ in timer's tracepoint format Xiao Guangrong
2009-12-22 13:20       ` Xiao Guangrong
2009-12-28  7:54       ` Ingo Molnar [this message]
2009-12-28 10:40         ` Xiao Guangrong
2009-12-29  5:20         ` [PATCH v3 0/5] perf tools: introduce 'perf timer' to analyze timer's behavior Xiao Guangrong
2009-12-29  5:21         ` [PATCH v3 1/5] perf_event: introduce 'inject' event and get HZ Xiao Guangrong
2009-12-30  9:19           ` Peter Zijlstra
2009-12-30  9:28             ` Ingo Molnar
2009-12-30  9:36               ` Peter Zijlstra
2009-12-30  9:44                 ` Ingo Molnar
2009-12-30 10:06                 ` Peter Zijlstra
2009-12-30 11:30                   ` Ingo Molnar
2009-12-30  9:37             ` Xiao Guangrong
2009-12-30  9:45               ` Peter Zijlstra
2009-12-29  5:21         ` [PATCH v3 2/5] trace_event: record task' real_timer in itimer_state tracepoint Xiao Guangrong
2009-12-29  5:21         ` [PATCH v3 3/5] perf tools: fix getting point Xiao Guangrong
2009-12-29  5:21         ` [PATCH v3 4/5] perf timer: add document for 'perf timer' Xiao Guangrong
2009-12-29  5:22         ` [PATCH v3 5/5] perf timer: add 'perf timer' core code Xiao Guangrong
2009-12-22 13:04     ` [PATCH v2 3/5] trace_event: record task' real_timer in itimer_state tracepoint Xiao Guangrong
2009-12-22 13:06       ` [PATCH v2 4/5] perf/timer: add document for 'perf timer' Xiao Guangrong
2009-12-22 13:08         ` [PATCH v2 5/5] perf/timer: add 'perf timer' core code Xiao Guangrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091228075417.GB20039@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=xiaoguangrong@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®