• Command "strace -T" introducing too much overhead

    From Pavankumar S V@21:1/5 to All on Sun Jul 23 22:49:52 2023
    Hello,

    I'm trying to check the execution time of each system call invoked by my application using strace -T.

    I got the trace output. But the time calculated by strace for each system call seemed inaccurate.

    To confirm the accuracy, I added few usleep(100) calls in my application. usleep is calling nanosleep() syscall. I expected the strace to show the time taken by nanosleep(100000) to be around 100 microseconds. But the values shown by strace for nanosleep(
    100000) is around 300 microseconds. For some calls, it is even showing 7 milliseconds.

    1. What is the reason for so much fluctuation in the execution time of a system call. Is this the issue with strace calculation or nanosleep(100000) is really taking a lot more than 100 microseconds to execute?

    2. If the issue is because of overhead introduced by strace, then the overhead is too much and strace is not useful to calculate the time taken by system call. Is there any way to avoid the overhead of strace? If not, is there any other tool to achieve
    the same?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)