[RFC][Patch 2/2] markers: example of irq regular kernel markers
Peter Zijlstra
peterz@infradead.org
Sat Jun 21 10:14:00 GMT 2008
On Fri, 2008-06-20 at 13:45 -0400, Mathieu Desnoyers wrote:
> All this work look good, thanks Masami! Sorry I did not find time to do
> it lately, I've been busy on other things. A small question though :
> since LTTng is configurable both as an external module or as an
> in-kernel tracer, I wonder if it would really hurt to add the format
> strings to DEFINE_TRACE, e.g. :
>
> DEFINE_TRACE(name, prototype, format_string, args...)
>
> which would give :
>
> DEFINE_TRACE(irq_entry, (int irq_id, int kernel_mode), "%d %d",
> irq_id, kernel_mode);
>
> DEFINE_TRACE(irq_exit, (void), MARK_NOARGS);
>
> and calling this in the kernel code :
>
> trace_irq_entry(irq, (regs)?(!user_mode(regs)):(1));
> ...
> trace_irq_exit();
>
> and for quick-and-dirty debug usage, one would add this to kernel code :
>
> trace_mark(subsystem_event, "(int arg, struct task_struct *task)",
> "%d %p", arg, current);
How would this work for:
DEFINE_TRACE(sched_switch, (struct task_struct *prev, struct task_struct *next), prev, next);
You'd want a string like: "%d %d", prev->pid, next->pid
not: "%p %p", prev, next
perhaps we can do something like:
DEFINE_TRACER(sched_switch, (struct task_struct *prev, struct task_struct *next), prev, next,
"%d %d", prev->pid, next->pid);
that defines a default tracer function for the previously defined trace
point. That way its optional, and allows for generic trace points.
Of course, all this could be ruined by reality - C really sucks wrt
forwarding functions.. :-/
More information about the Systemtap
mailing list