Re: [tip:timers/tracing] hrtimer: Add tracepoint for hrtimers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Wed, 2009-09-02 at 12:18 +0000, tip-bot for Xiao Guangrong wrote:
> 
> > +/**
> > + * hrtimer_start - called when the hrtimer is started
> > + * @timer: pointer to struct hrtimer
> > + */
> > +TRACE_EVENT(hrtimer_start,
> > +
> > +	TP_PROTO(struct hrtimer *timer),
> > +
> > +	TP_ARGS(timer),
> > +
> > +	TP_STRUCT__entry(
> > +		__field( void *,	timer		)
> > +		__field( void *,	function	)
> > +		__field( s64,		expires		)
> > +		__field( s64,		softexpires	)
> > +	),
> > +
> > +	TP_fast_assign(
> > +		__entry->timer		= timer;
> > +		__entry->function	= timer->function;
> > +		__entry->expires	= hrtimer_get_expires(timer).tv64;
> > +		__entry->softexpires	= hrtimer_get_softexpires(timer).tv64;
> > +	),
> > +
> > +	TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu",
> > +		  __entry->timer, __entry->function,
> > +		  (unsigned long long)ktime_to_ns((ktime_t) {
> > +				  .tv64 = __entry->expires }),
> > +		  (unsigned long long)ktime_to_ns((ktime_t) {
> > +				  .tv64 = __entry->softexpires }))
> > +);
> > +
> 
> I was just fixing up the trace-cmd parser (which is also used for perf)
> and came across this code. That TP_printk shows up in the format file
> as:
> 
> print fmt: "hrtimer %p, func %pf, expires %llu, softexpires %llu", REC->timer, REC->function, (unsigned long long)(((ktime_t) { .tv64 = REC->expires }).tv64), (unsigned long long)(((ktime_t) { .tv64 = REC->softexpires }).tv64)
> 
> Now I'm trying to parse this with a tool so that we can have something
> that can read the binary output, and be able to easily figure it out by
> reading the format files. But trying to parse:
> 
> (unsigned long long)(((ktime_t) { .tv64 = REC->expires }).tv64)
> 
> Is not easy. It's basically implementing a C interpreter :-(

Btw., what i suggested quite some time ago was that we should bind 
tracepoints by emitting C source code stubs, which tools can then build 
and link in, using gcc.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux