[lttng-dev] lttng-track on userspace channel

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Jun 1 18:24:48 UTC 2017


----- On May 31, 2017, at 7:28 PM, Deneau, Tom tom.deneau at amd.com wrote:

> I am using lttng 2.9.4.
> 
> I have a server database daemon with many threads and I would like to track
> events on a smaller subset of those threads.
> I noticed that on the kernel channel I can use lttng track --pid=123,124,125
> 
> and this will trace kernel events for just those TIDS (in spite of the
> documentation saying it will track whole pids).
> But I am happy because tid tracking is what I want.

Argh.. this is an unfortunate discrepancy! It should have been using
the kernel "tgid" at kernel-level to match what we do for userspace.
I'll prepare a patch fixing that.

LTTng really try hard to stick to "pid means process ID" and "tid means
thread ID". Internally in lttng-modules we do all that is needed to map
the pid/tgid notions back to tid/pid.

> 
> However, is there an equivalent way to track certain tids on the userspace
> channel?  I find that if I use
>    lttng track -u --pid=xxx
> it just tracks all the tids under that pid.

You can use e.g.

lttng enable-event -k -a --filter '$ctx.tid == 123'

or if you want it container-aware:

lttng enable-event -k -a --filter '$ctx.vtid == 123'

Thanks,

Mathieu

> 
> Here is my script (where 79653 is a single tid).  In this case it traces only
> kernel events on that tid.
> -----------
> lttng create
> lttng enable-channel u -u --num-subbuf 64 --subbuf-size 512k
> lttng enable-channel k -k --num-subbuf 64 --subbuf-size 512k
> lttng add-context -k -c k -t tid -t pid
> lttng add-context -u -c u -t vtid -t vpid
> lttng enable-event -u -c u -a
> lttng enable-event -k -c k --syscall futex
> lttng track -k --pid=79653
> lttng track -u --pid=79653
> lttng start
> sleep 1.0
> lttng stop
> lttng destroy
> 
> -- Tom Deneau
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list