To see the timestamp at which a system call executes and how much time spent on each system, try -Tttt option in strace. There are different formats of this.

  • -t     : Gives time of day
  • -tt    : Gives time of day – includes microseconds
  • -ttt   : Gives time of fay – includes microseconds, prints time since epoch
  • -T     : Gives the time spent on each system call [ the last column of the strace output ]

For example :

[root@unixfoo ~]# strace -ttT pwd
08:17:46.923913 execve(“/bin/pwd”, [“pwd”], [/* 20 vars */]) = 0 <0.000528>
08:17:46.925286 uname({sys=”Linux”, node=”unixfoo”, …}) = 0 <0.000021>
08:17:46.925758 brk(0)                  = 0x804c000 <0.000019>
08:17:46.926107 access(“/etc/ld.so.preload”, R_OK) = -1 ENOENT (No such file or directory) <0.000024>
08:17:46.926523 open(“/etc/ld.so.cache”, O_RDONLY) = 3 <0.000030>
08:17:46.926871 fstat64(3, {st_mode=S_IFREG|0644, st_size=25140, …}) = 0 <0.000019>
<snip>

Leave a Reply

Your email address will not be published. Required fields are marked *