strace -f -p <PID> traces system calls in all threads of a multi-threaded process. (This also follows forks, there is an option -b execve that tries to address that).

Does perf trace -p <PID> trace all threads of the process? It looks like it should do, because it also has a --tid option.

I think I traced all the gnome-shell PIDs on my system. But, at the same time I ran perf trace -a. I filtered both traces using -e fsync. The global trace showed gnome-shell tasks calling fsync. But the PID-specific trace did not.

In the global trace, the task was identified as either gnome-shell/9822 or pool/9822. The call stack for the fsync call (I used --call-graph=dwarf) looks very thready: the bottom two entries were __GI___clone and start_thread (/usr/lib64/libpthread-2.27.so). I can't find this thread in the current output of ps -eLF. Based on this and the name pool, I suspect it was a temporary worker thread. Does perf trace -p <PID> perhaps not follow newly created threads?

Version: perf-4.19.3-200.fc28.x86_64

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.