Linux – the time unit that strace uses when displaying time spent in syscalls

linuxprocessstracesyscallssystem-calls

When using the command strace with the flag -T, I would like to know what is the time unit used to display time spent in syscalls? I assume it should be in seconds, but I am not quite sure and it seems to be omitted from the manual.

Best Answer

From the source code:

if (Tflag) {
    ts_sub(ts, ts, &tcp->etime);
    tprintf(" <%ld.%06ld>",
        (long) ts->tv_sec, (long) ts->tv_nsec / 1000);
}

This means that the time is shown in seconds, with microseconds (calculated from the nanosecond value) after the decimal point.

Related Question