[lttng-dev] Beginner question: how to inspect scheduling of multi-threaded user application?

Jonathan Rajotte Julien Jonathan.rajotte-julien at efficios.com
Mon Sep 19 15:54:41 UTC 2016


Hi,

On 2016-09-19 11:38 AM, David Aldrich wrote:
> Hi Jonathan
>
> Thanks for your reply. What is 'comm' in 'prev_comm'?

It correspond to the "comm" member of the task_struct struct [1].

The important part of [1]:

char comm[TASK_COMM_LEN]; /* executable name excluding path
                              - access with [gs]et_task_comm (which lock
                                it with task_lock())
                              - initialized normally by setup_new_exec */

Also know as the executable name.

Cheers.

[1] include/linux/sched.h of the kernel tree


>
> Best regards
>
> David
>
>> -----Original Message-----
>> From: lttng-dev [mailto:lttng-dev-bounces at lists.lttng.org] On Behalf Of
>> Jonathan Rajotte Julien
>> Sent: 16 September 2016 18:37
>> To: lttng-dev at lists.lttng.org
>> Subject: Re: [lttng-dev] Beginner question: how to inspect scheduling of
>> multi-threaded user application?
>>
>> Hi
>>
>>
>> On 2016-09-16 07:43 AM, David Aldrich wrote:
>>> Hi
>>>
>>> I wonder if I might ask for some more guidance please?
>>>
>>> I now have lttng and Trace Compass running on Ubuntu.  I want to inspect
>> the scheduling of threads in my user-space application.  So far, I have
>> successfully captured a trace with the sched_switch event enabled:
>>> $ sudo lttng enable-event -k sched_switch
>>>
>>> This indeed shows my app's threads.  However, it also shows all the other
>> threads in the system and does not show clearly (to my understanding)
>> when the threads are scheduled / blocked.
>>> I would like some guidance on how to improve this tracing.
>>>
>>> 1) Would it be better if I defined my own “tracepoint providers” and then
>> set trace events for when a thread wakes / blocks?
>>
>> Could be a solution but you might want the built-in utility of lttng to filter
>> out all noise first using the filtering feature.
>>
>> e.g I'm interested in sched_switch event where chrome is involved
>>
>> lttng create
>> lttng enable-event --kernel "sched_switch" --filter 'prev_comm == "chrome*"
>> || next_comm == "chrome*"'
>> lttng start
>> ....
>>
>> Using TraceCompass you will be mainly interested in the Control Flow View
>> and the Resource view (show per cpu timeline activity).
>>
>>> 2) How could I show which core a thread is running on?
>> The Resource view from TraceCompass should help here.
>>
>> Cheers
>>
>>> Best regards
>>>
>>> David
>>> _______________________________________________
>>> lttng-dev mailing list
>>> lttng-dev at lists.lttng.org
>>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>> --
>> Jonathan R. Julien
>> Efficios
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>
>>
>>   Click
>> https://www.mailcontrol.com/sr/YRkaDi7sHfjGX2PQPOmvUu5zZAYN1MosBr
>> 5yrM8i6yLTqipdxOLNFC1fulULj1tW45N!9c+2yXxm4uq9tqSB7g==  to report
>> this email as spam.

-- 
Jonathan R. Julien
Efficios



More information about the lttng-dev mailing list