Hi,
In order to support situations where a user wants generally all
tracepoints enabled but specific tracepoints to be suppressed during a
trace session, I created a small patch that allows us to do the following:
...
lttng enable-event -u -c met_tools -a
lttng enable-event -u -c met_tools --tracepoint '!met_func:*'
lttng enable-event -u -c met_tools --tracepoint '!met_call:*'
...
This has the effect that all tracepoints get recorded except for
tracepoints that match met_func:* or met_call:*.
If you think this feature is useful for others we would be happy to see
this patch merged into trunk.
Thanks,
Paul
--
Paul Woegerer | SW Development Engineer
Mentor Embedded(tm) | Prinz Eugen Straße 72/2/4, Vienna, 1040 Austria
P 43.1.535991320
Nucleus® | Linux® | Android(tm) | Services | UI | Multi-OS
Android is a trademark of Google Inc. Use of this trademark is subject to
Google Permissions.
Linux is the registered trademark of Linus Torvalds in the U.S. and other
countries.
>From 74602f6f4ea4b1d7faa01f76542f62b496b94091 Mon Sep 17 00:00:00 2001
From: Paul Woegerer <[email protected]>
Date: Wed, 27 Jun 2012 15:21:30 +0200
Subject: [PATCH] Added excluding/filtering of events with !NAME
---
liblttng-ust/ltt-events.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c
index 0fdfd2f..b663312 100644
--- a/liblttng-ust/ltt-events.c
+++ b/liblttng-ust/ltt-events.c
@@ -150,11 +150,32 @@ struct wildcard_entry *match_wildcard(const struct lttng_event_desc *desc)
struct wildcard_entry *e;
cds_list_for_each_entry(e, &wildcard_list, list) {
+ size_t len = strlen(e->name);
+ if (len < 1 || e->name[0] != '!')
+ continue;
+
+ DBG("Filter %s against wildcard_entry %s\n", desc->name, e->name);
+
+ /* Compare exclusion wildcards excluding initial '!' and final '*' */
+ if (!strncmp(desc->name, e->name + 1, len - 2))
+ {
+ DBG("Exclude %s due to exclusion wildcard_entry %s\n", desc->name, e->name);
+ return NULL; /* exclusion wildcard matched */
+ }
+ }
+
+ cds_list_for_each_entry(e, &wildcard_list, list) {
+ size_t len = strlen(e->name);
+ if (len > 0 && e->name[0] == '!')
+ continue;
+
+ DBG("Match %s against wildcard_entry %s\n", desc->name, e->name);
+
/* If only contain '*' */
- if (strlen(e->name) == 1)
+ if (len == 1)
goto possible_match;
/* Compare excluding final '*' */
- if (!strncmp(desc->name, e->name, strlen(e->name) - 1))
+ if (!strncmp(desc->name, e->name, len - 1))
goto possible_match;
continue; /* goto next, no match */
possible_match:
@@ -507,6 +528,13 @@ int ltt_event_create(struct ltt_channel *chan,
struct ltt_event *event;
int ret = 0;
+ if (strlen(event_param->name) > 0 && event_param->name[0] == '!')
+ {
+ struct session_wildcard *sw = NULL;
+ ltt_wildcard_create(chan, event_param, &sw );
+ goto filter;
+ }
+
if (chan->used_event_id == -1U) {
ret = -ENOMEM;
goto full;
@@ -607,6 +635,7 @@ cache_error:
no_loglevel_match:
exist:
full:
+filter:
return ret;
}
--
1.7.10.4
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev