Using strace for analyzing performance

There is a very nice example on the O’reilly ‘Linux Under The Hood’ training about using strace to compare performance of two commands that provide the same output but with different calls. The two different commands were: ls and echo *, that they both provide the listing of the current directory.

First using the strace with ls:

And using the same with echo *

So the difference in time is 0.00000 for the echo and 0.000601 for the ls.

Similarly the number of calls for the echo is 33, but ls is using 100.