[lttng-dev] Filtering tracing by process name or PID/TID

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Feb 15 14:33:18 EST 2023


On 2023-02-15 04:09, Rengar Stinkt via lttng-dev wrote:
> Dear community,
> I only recently started working with lttng tracing due to work related 
> projects, so I am very new to this. I have done some research before 
> posting this but I can't seem to find an answer.
> I am running several CPU load tests for specific processes on different 
> devices using lttng and TraceCompass for visualization. I am running 
> into the issue that 99.9% of traced processes are not of value to me and 
> the tracing files get extremely big and hard to work with (filtering 
> with TraceCompass is very slow).
> Now I thought of filtering the processes before tracing and I found 
> filtering by PID and TID. The issue with this is that the PIDs and TIDs 
> are unique on each device but change between devices.
> I then found the command "htop -d 0.1 -u **String**" to see currently 
> running processes with a certain name.
> Now if I run this it shows me the running process IF they are running. I 
> have time triggered and event triggered processes. There are many 
> inconvenient workarounds to make it work, like triggering the events and 
> finding out the PID and then manually copying all of the IDs and pasting 
> them into "lttng track --kernel --pid=""". But I am trying to find a way 
> to either filter by name right away, avoiding relying on PIDs or at 
> least to have an automated process of doing it. But I am unfamiliar with 
> running code in the PuTTY terminal that we are using, so I am trying to 
> avoid this (for now). If this is the only option though, I will have to 
> look into it.
> Is there any way to filter by name right away like in the mentioned htop 
> command?
> Thank you so much in advance.

This would be:

lttng enable-event -k event_name --filter '$ctx.procname == "string"'

Where "string" can include wildcards as well.

Hoping this helps,

Mathieu


> Dom
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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



More information about the lttng-dev mailing list