Sample Header Ad - 728x90

Strace shows that the time spent in syscalls is much longer than the total time elapsed. Why?

3 votes
1 answer
1836 views
I am running an AI inference program based on Tensorflow-gpu. By running /usr/bin/strace -c -f /usr/bin/time ./program, I got the following output:
367.91user 1032.14system 26:43.41elapsed 87%CPU (0avgtext+0avgdata 4158812maxresident)k 
------ ----------- ----------- --------- --------- ----------------
100.00 38559.038652               5385548    247845 total
It shows that my program spent 34105 seconds in futex alone, which is **20 times longer** than the elapsed time of 26:43.41. I assumed that strace was recording the total system call time on all of my cores, so I re-experimented with only a single core enabled (using taskset), but the problem persisted. **Edit:** I did use taskset with the --all-tasks option:
/usr/bin/taskset --all-tasks --cpu-list 0 /usr/bin/strace  -c -f /usr/bin/time ./program
Asked by Azuresonance (73 rep)
Mar 9, 2021, 03:20 AM
Last activity: Mar 9, 2021, 07:30 PM