Re: [PATCH 13/15] small_traces: Add config option to shrink trace events.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Rostedt
Date: Friday, December 3, 2010 - 7:54 pm

On Fri, 2010-12-03 at 18:33 -0800, David Sharp wrote:

I would not touch the TRACE_EVENT() structures. They are there as is and
I would not think about changing them. Something like that would never
make it into mainline.

Now what you can do, is to make your own events based off of the same
tracepoints. For example, the TRACE_EVENT(sched_switch...) has in
sched.c:

	trace_sched_switch(prev, next);


You could even write a module that does something like this:

	register_trace_sched_switch(probe_sched_switch, mydata);



void probe_sched_switch(void *mydata,
		struct task_struct *prev,
		struct task_struct *next)
{
	struct ring_buffer *buffer;
	struct ring_buffer_event *event;
	struct myentry *entry;

	event = trace_current_buffer_lock_reserve(buffer,
			mytype, sizeof(*entry),
			0, 0);

	if (!event)
		return;

	entry = ring_buffer_event_data(event);

	entry->myfield = prev->x;
	...

	trace_nowake_buffer_unlock_commit(buffer, event,
					0, 0);
}

You will need to do a register_ftrace_event() to register that 'mytype'
and how to output it. Otherwise it would just be ignored in the "trace"
file.

All of the above would work fine as a loadable module that you could
easily maintain out of tree, and still uses the internals of the system.

-- Steve


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

Messages in current thread:
[Patch 00/15] Reduce tracing payload size., David Sharp, (Fri Dec 3, 5:13 pm)
[PATCH 04/15] ftrace: pack event structures., David Sharp, (Fri Dec 3, 5:13 pm)
[PATCH 10/15] ftrace: fix event alignment: jbd2:*, David Sharp, (Fri Dec 3, 5:13 pm)
[PATCH 11/15] ftrace: fix event alignment: ext4:*, David Sharp, (Fri Dec 3, 5:13 pm)
Re: [PATCH 10/15] ftrace: fix event alignment: jbd2:*, Steven Rostedt, (Fri Dec 3, 6:52 pm)
Re: [PATCH 11/15] ftrace: fix event alignment: ext4:*, Steven Rostedt, (Fri Dec 3, 6:53 pm)
Re: [PATCH 13/15] small_traces: Add config option to shrin ..., Steven Rostedt, (Fri Dec 3, 7:54 pm)
Re: [Patch 00/15] Reduce tracing payload size., Andi Kleen, (Mon Dec 6, 6:22 am)
Re: [Patch 00/15] Reduce tracing payload size., Ted Ts'o, (Mon Dec 6, 6:56 am)
Re: [Patch 00/15] Reduce tracing payload size., Andi Kleen, (Mon Dec 6, 7:58 am)
Re: [Patch 00/15] Reduce tracing payload size., Steven Rostedt, (Mon Dec 6, 9:17 am)
Re: [Patch 00/15] Reduce tracing payload size., Miguel Ojeda, (Mon Dec 6, 9:31 am)
Re: [Patch 00/15] Reduce tracing payload size., Andi Kleen, (Mon Dec 6, 9:41 am)
[PATCH] tracing: Add an 'overwrite' trace_option., David Sharp, (Wed Dec 8, 2:46 pm)
Re: [PATCH 08/15] ftrace: fix event alignment: mce:mce_record, Frederic Weisbecker, (Thu Dec 9, 6:33 am)
Re: [PATCH 13/15] small_traces: Add config option to shrin ..., Frederic Weisbecker, (Thu Dec 9, 7:55 am)
Re: [PATCH 13/15] small_traces: Add config option to shrin ..., Frederic Weisbecker, (Thu Dec 9, 8:28 am)
Re: [PATCH] tracing: Add an 'overwrite' trace_option., David Sharp, (Mon Dec 13, 5:39 pm)