One of the many enhancements to well known tools like truss
was the introduction of the option -G
to said command. When you truss
for a command with -E
it shows you the delta between entering the syscall and exiting it. However that doesn’t nessesarily means, that the syscall was working all the time, for all purposes it could have slept most of the time. Still when you stay for example in the nanosleep
syscall it will show one second of runtime albeit significantly less time was active processing. As the nanosleep
name suggests, it sleeps and does only a little bit of work.
Sometimes you want to know, how long the the syscall was actually doing something. With the -G
option the time shown by truss is actually showing how much time the syscall did some processing (or to say it differently: was not sleeping).
I think an example makes the difference clear. I’m using an example that was used by a colleague because it’s so great to show the difference between the two options.