Reputation: 13453
I have a program that should be CPU bound, but it is using well less than 100% CPU, and is not consuming input as fast as it can. It means my process is blocking or sleeping somewhere.
How to find what calls are blocking my process for the most time? Is there a tool or debugging procedure that measures the time how much time the process is asleep on each blocking system call?
Upvotes: 3
Views: 90
Reputation: 123490
strace
is an option:
$ strace -wc sleep 1
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
99.96 1.000146 1000146 1 nanosleep
0.01 0.000131 131 1 execve
0.01 0.000082 10 8 mmap
[...]
Upvotes: 3