Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH] tracepoint event exclusion
Date: Wed, 27 Jun 2012 14:33:08 -0400	[thread overview]
Message-ID: <20120627183308.GA19735@Krystal> (raw)
In-Reply-To: <4FEB13CE.1010206@mentor.com>

* 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@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



  reply	other threads:[~2012-06-27 18:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 14:08 Woegerer, Paul
2012-06-27 18:33 ` Mathieu Desnoyers [this message]
2012-06-28  9:26   ` Woegerer, Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120627183308.GA19735@Krystal \
    --to=mathieu.desnoyers@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox