[lttng-dev] [PATCH] tracepoint event exclusion

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Jun 27 14:33:08 EDT 2012


* Woegerer, Paul (Paul_Woegerer at mentor.com) wrote:
> 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:*'

hrm, although possibly interesting, I don't think this semantic follows
the lttng UI event enabling semantic. There are a few use-cases to
cover:

1) enable tracepoints, start tracing, run app.

2) enable some tracepoints, start tracing, run app, enable more
   tracepoints while app is running.

3) start tracing, run app, enable all tracepoints while app is running.

AFAIU, your patch and proposed semantic covers use-case #1, but breaks
the other 2. Basically, we have to apply a logical "or" between each
enable-event command (rather than an "and" as your proposed semantic
suggests), because they can be applied independently.

We could however try to come up with an event attribute that gets
applied on a specific event, e.g.:

lttng enable-event -u -a --exclude 'met_func:*' --exclude 'met_call:*'

thoughts ?

Thanks,

Mathieu

> ...
>
> 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 <paul_woegerer at mentor.com>
> 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
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list