aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-01-27 23:12:05 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-02-07 20:56:19 -0500
commit55719274188f13cff9e3bd11fdd4c0e7617cd03d (patch)
treee9291f7b720e9a1723f94b69ec381360ca275ce2 /kernel/trace
parent61e9dea20e1ada886cc49a9ec6fe3c6ac0de7324 (diff)
tracing/filter: Optimize short ciruit check
The test if we should break out early for OR and AND operations can be optimized by comparing the current result with (pred->op == OP_OR) That is if the result is true and the op is an OP_OR, or if the result is false and the op is not an OP_OR (thus an OP_AND) we can break out early in either case. Otherwise we continue processing. Cc: Tom Zanussi <tzanussi@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_events_filter.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 10390491b6d0..0a3e0502b507 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -426,9 +426,15 @@ int filter_match_preds(struct event_filter *filter, void *rec)
426 pred->parent, &move); 426 pred->parent, &move);
427 continue; 427 continue;
428 case MOVE_UP_FROM_LEFT: 428 case MOVE_UP_FROM_LEFT:
429 /* Check for short circuits */ 429 /*
430 if ((match && pred->op == OP_OR) || 430 * Check for short circuits.
431 (!match && pred->op == OP_AND)) { 431 *
432 * Optimization: !!match == (pred->op == OP_OR)
433 * is the same as:
434 * if ((match && pred->op == OP_OR) ||
435 * (!match && pred->op == OP_AND))
436 */
437 if (!!match == (pred->op == OP_OR)) {
432 if (pred == root) 438 if (pred == root)
433 break; 439 break;
434 pred = get_pred_parent(pred, preds, 440 pred = get_pred_parent(pred, preds,