[lttng-dev] Enable UST probes only in specific process
Jérémie Galarneau
jeremie.galarneau at efficios.com
Thu Jul 31 14:15:01 EDT 2014
On Thu, Jul 31, 2014 at 1:29 PM, Dmitri Shubin <sbn at tbricks.com> wrote:
> 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
>
That's an interesting workaround!
> 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
>
Indeed, that would be nice.
> For instance in dtrace I can explicitly specify process I want to trace by
> appending its PID to probe name.
You'll be glad to learn that we'll be adding this feature by the end
of the year. Probably within the 2.7 release timeframe.
Regards,
Jérémie
>
> Regards!
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list