aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2011-08-11 10:25:50 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-08-19 14:35:55 -0400
commitc00b060f36e1238816ebcf2c8cccd5e9fa068980 (patch)
treecd9762a0c956d80edd556001178bd5426106d81e /kernel/trace
parentf03f5979945c573801c25ba3089ef17c4d7edc61 (diff)
tracing/filter: Change count_leafs function to use walk_pred_tree
Changing count_leafs function to use unified predicates tree processing. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/1313072754-4620-7-git-send-email-jolsa@redhat.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_events_filter.c47
1 files changed, 14 insertions, 33 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 5b889d43d856..ebbb2611982e 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1418,43 +1418,24 @@ static int check_pred_tree(struct event_filter *filter,
1418 check_pred_tree_cb, &data); 1418 check_pred_tree_cb, &data);
1419} 1419}
1420 1420
1421static int count_leafs(struct filter_pred *preds, struct filter_pred *root) 1421static int count_leafs_cb(enum move_type move, struct filter_pred *pred,
1422 int *err, void *data)
1422{ 1423{
1423 struct filter_pred *pred; 1424 int *count = data;
1424 enum move_type move = MOVE_DOWN;
1425 int count = 0;
1426 int done = 0;
1427 1425
1428 pred = root; 1426 if ((move == MOVE_DOWN) &&
1427 (pred->left == FILTER_PRED_INVALID))
1428 (*count)++;
1429 1429
1430 do { 1430 return WALK_PRED_DEFAULT;
1431 switch (move) { 1431}
1432 case MOVE_DOWN: 1432
1433 if (pred->left != FILTER_PRED_INVALID) { 1433static int count_leafs(struct filter_pred *preds, struct filter_pred *root)
1434 pred = &preds[pred->left]; 1434{
1435 continue; 1435 int count = 0, ret;
1436 }
1437 /* A leaf at the root is just a leaf in the tree */
1438 if (pred == root)
1439 return 1;
1440 count++;
1441 pred = get_pred_parent(pred, preds,
1442 pred->parent, &move);
1443 continue;
1444 case MOVE_UP_FROM_LEFT:
1445 pred = &preds[pred->right];
1446 move = MOVE_DOWN;
1447 continue;
1448 case MOVE_UP_FROM_RIGHT:
1449 if (pred == root)
1450 break;
1451 pred = get_pred_parent(pred, preds,
1452 pred->parent, &move);
1453 continue;
1454 }
1455 done = 1;
1456 } while (!done);
1457 1436
1437 ret = walk_pred_tree(preds, root, count_leafs_cb, &count);
1438 WARN_ON(ret);
1458 return count; 1439 return count;
1459} 1440}
1460 1441