Re: trace_mark ugliness

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Mathieu Desnoyers <mathieu.desnoyers@...>
Cc: Steven Rostedt <rostedt@...>, Ingo Molnar <mingo@...>, Christoph Hellwig <hch@...>, LKML <linux-kernel@...>
Date: Sunday, May 25, 2008 - 7:20 am

On Thu, 2008-05-22 at 13:16 -0400, Mathieu Desnoyers wrote:


How about something like:

marker.c:

void __trace_mark(const struct marker *mdata, va_list *args)
{
	int i;

	preempt_disable();
	for (i = 0; multi[i].func; i++) {
		va_list l;

		va_copy(l, *args);
		multi[i].func(multi[i].probe_private, &l);
		va_end(l);
	}
	preempt_enable();
}


marker.h:

#define TRACE_FUNC(name, args...)				\
static inline void trace_##name(const struct marker *mdata, ## args) \
{								\
	va_list l;						\
	va_start(l, mdata);					\
	__trace_mark(mdata, &l);				\
	va_end(l);						\
}

#define TRACE_MARK(name, args...)				\
	trace_##name(trace_##name##_data, ## args)

TRACE_FUNC(sched_switch, const struct task_struct *prev, const struct task_struct *next)


sched.c:

	TRACE_MARK(sched_switch, prev, next);

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
trace_mark ugliness, Steven Rostedt, (Thu May 22, 10:24 am)
Re: trace_mark ugliness, Mathieu Desnoyers, (Thu May 22, 1:16 pm)
Re: trace_mark ugliness, Peter Zijlstra, (Sun May 25, 7:20 am)
Re: trace_mark ugliness, Mathieu Desnoyers, (Tue May 27, 9:36 am)
Re: trace_mark ugliness, Peter Zijlstra, (Wed May 28, 11:19 am)
Re: trace_mark ugliness, Steven Rostedt, (Thu May 22, 1:52 pm)