|| ||Steven Rostedt <email@example.com> |
|| ||firstname.lastname@example.org |
|| ||[RFC][PATCH 0/2] tracing: Add conditional to tracepoints |
|| ||Thu, 02 Dec 2010 17:36:54 -0500|
|| ||Ingo Molnar <email@example.com>,
Andrew Morton <firstname.lastname@example.org>,
Thomas Gleixner <email@example.com>,
Peter Zijlstra <firstname.lastname@example.org>,
Frederic Weisbecker <email@example.com>,
Linus Torvalds <firstname.lastname@example.org>,
Theodore Tso <email@example.com>,
Arjan van de Ven <firstname.lastname@example.org>,
Mathieu Desnoyers <email@example.com>|
|| ||Article, Thread
This is an RFC that adds the TP_CONDITION() to the TRACE_EVENT()
There are certain cases that a tracepoint only makes sense if
a specific condition is met. But because we do not want to dirty
the fast path (the non tracing case) with if statements that are
there only to avoid tracing, we just pass the condition variables
to the tracepoint, and let the user filter them out if needed.
A perfect example is the tracepoint sched_wakeup. It traces all
calls to try_to_wake_up() even if it fails to wake up. But if we add:
We have that "if (success)" tested for every time we call try_to_wake_up().
Even when tracing is not (or never will be) enabled.
This patch set adds a variant TRACE_EVENT_CONDITIONAL()
(and DECLARE_EVENT_CLASS_CONDITIONAL()) that has a "cond" argument.
This argument is encapsulated with "TP_CONDITIONAL()" which turns into:
This is placed inside the called tracepoint routine, and is only tested
when the trace is enabled. Otherwise it is a nop as tracepoints normally
are when disabled.
Note, another variant of this, is to move the test directly into the
_DO_TRACE() macro, and not call any registered event callbacks. This would
even speed it up faster when tracing is enabled. I did not do this
orginially because I just thought of it now as I wrote this change log ;-)
I'm posting this version now just in case people prefer it instead.
The following patches are in:
Steven Rostedt (2):
tracing: Add TRACE_EVENT_CONDITIONAL()
tracing: Only trace sched_wakeup if it actually work something up
include/linux/tracepoint.h | 3 ++
include/trace/define_trace.h | 6 +++
include/trace/events/sched.h | 12 +++---
include/trace/ftrace.h | 70 +++++++++++++++++++++++++++++++----------
4 files changed, 68 insertions(+), 23 deletions(-)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/