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).
perf trace -p <PID> trace all threads of the process? It looks like it should do, because it also has a
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
pool/9822. The call stack for the
fsync call (I used
--call-graph=dwarf) looks very thready: the bottom two entries were
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?