I am looking for a method to analyze the multithreading problems in Linux user programs without affecting the program's own behaviour. I'm wondering whether it is possible to analyze the multithreading problem of user programs from the kernel event tracer or not?
Asked
Active
Viewed 330 times
1 Answers
1
Yes, LTTng works very well for that use-case, you can start by enabling the scheduling events (sched*), the statedump events (lttng_statedump_*) and the system calls events and you should have quickly a good idea of your program behavior. You can look at the trace in TraceCompass to inspect it visually, or with the lttng-analyses scripts to extract usage and latency metrics from your trace.

Julien Desfossez
- 11
- 1
-
Could you tell me what system call events should I enable? – tudv Jan 12 '18 at 04:00
-
Moreover, how can I observe the mutex lock/unlock events of POSIX thread by tracing the Linux kernel? – tudv Jan 15 '18 at 04:09
-
You should start with all system calls (lttng enable-event -k --syscall -a) and after you know what you are looking for, you could enable only the ones you really want, but it depends on your application and what you want to observe. – Julien Desfossez Jan 16 '18 at 15:57
-
You won't see all the mutex lock/unlock from the kernel trace, if you want to see everything, you need to use LTTng-UST with the liblttng-ust-pthread-wrapper.so library preloaded. – Julien Desfossez Jan 16 '18 at 16:04
-
Thank you, I will check that – tudv Jan 17 '18 at 04:44