[lttng-dev] Enable UST probes only in specific process

Dmitri Shubin sbn at tbricks.com
Thu Jul 31 13:29:23 EDT 2014


Hi Jérémie,


On Wed, Jul 30, 2014 at 10:31 PM, Jérémie Galarneau <
jeremie.galarneau at efficios.com> wrote:

> On Wed, Jul 30, 2014 at 9:58 AM, Dmitri Shubin <sbn at tbricks.com> wrote:
> > AFAIU
> > lttng enable-event -u prov:probe --filter '$ctx.vpid==12345'
> > enables probe for all processes and then drops unmatched.
> >
>
> Correct. The event won't be traced.
>

I.e. it won't be written to trace buffer/file, ok.


> The arguments won't be evaluated if the event is not enabled. However,
> when an event is enabled, the arguments are evaluated regardless of
> the result of the filter's expression evaluation since it could be
> based on the event's content.
>
> Let me know if that's not what you meant.
>

Yes, exactly.
I pass stack trace as an argument to the tracepoint.
So it's computed just to be dropped...


> > The only way I can do it now is playing with LTTNG_HOME variable setting
> it
> > to different paths for each process.
>
> I'm not sure I understand what you mean here. Care to elaborate?
>

$ cat a.c
#include <stdlib.h>
#include <unistd.h>
#include <lttng/tracef.h>

int main()
{
    for (;;) {
        tracef("hello", (abort(), 1));
        sleep(1);
    }

    return 0;
}
$ gcc a.c -llttng-ust
$ mkdir /tmp/lttng-home-1 /tmp/lttng-home-2
$ LTTNG_HOME=/tmp/lttng-home-1 ./a.out &
[1] 13029
$ LTTNG_HOME=/tmp/lttng-home-2 ./a.out &
[2] 13032
$ export LTTNG_HOME=/tmp/lttng-home-1
$ lttng create
Spawning a session daemon
Session auto-20140731-211730 created.
Traces will be written in
/tmp/lttng-home-1/lttng-traces/auto-20140731-211730
$ lttng enable-event -u lttng_ust_tracef:event
UST event lttng_ust_tracef:event created in channel channel0
$ lttng start
Tracing started for session auto-20140731-211730
$
[1]-  Aborted                 (core dumped) LTTNG_HOME=/tmp/lttng-home-1
./a.out

I.e. here I have separate session per each process I want to trace.
It would be easier if I can have channel per process, like e.g.
$ lttng enable-channel -p 12345

For instance in dtrace I can explicitly specify process I want to trace by
appending its PID to probe name.

Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140731/cce997e7/attachment.html>


More information about the lttng-dev mailing list