Tweaks for -c: fixed setitimer/getitimer hack; optimized call_summary_pers()
Tweaks for -c: fixed setitimer/getitimer hack; optimized call_summary_pers()

count_syscall() was calling setitimer/getitimer once in order to find
smallest "tick" OS uses in time accounting, in order to use it
for syscalls which apparently spent less than that time in syscall.
The code assumed that this "tick" is not zero... but it is zero
on linux-3.6.11. Which means that this hack doesn't work...

At least this change prevents this measurement from being done
_repeatedly_, by initializing one_tick to -1, not 0.

While at it, added comments in count_syscall() explaining what we are doing.

Optimized call_summary_pers() a bit, by eliminating redundant tv -> float
conversions, and prevented 0.0/0.0 which was resulting in "% time"
being shown as "-nan" if total CPU time spent was 0.000000
(try "strace -c /bin/true").

The code seems to seriously underestimate CPU usage:
"strace -c ls -lR /usr/share >/dev/null" shows total time spent
in syscalls to be only ~10..20% of what "time ls -lR /usr/share >/dev/null"
shows.

It might be useful to have a mode where we show wall clock time
spent in syscalls, not CPU time. It might also be more accurate.

   text	   data	    bss	    dec	    hex	filename
 245019	    676	   5708	 251403	  3d60b	strace_old
 244923	    684	   5676	 251283	  3d593	strace

Signed-off-by: Denys Vlasenko <42afb3a19136e88700e8b77002ea6a5a94c16782@googlemail.com>

bnoordhuis/strace,pgbovine/strace-plus,pombredanne/strace,TeamExodus/external_strace,lkundrak/strace,TeamExodus/external_strace,geekboxzone/mmallow_external_strace,geekboxzone/mmallow_external_strace,cuviper/strace,Yu-AndroidM/android_external_strace,cuviper/strace,YUPlayGodDev/platform_external_strace,geekboxzone/lollipop_external_strace,cuviper/strace,jamel/strace-plus,Saruta/strace,Saruta/strace,Yu-AndroidM/android_external_strace,pombredanne/strace,bnoordhuis/strace,android-ia/platform_external_strace,bigzz/strace_android,Saruta/strace,geekboxzone/lollipop_external_strace,jamel/strace-plus,Yu-AndroidM/android_external_strace,xin3liang/platform_external_strace,kapdop/android_external_strace,geekboxzone/mmallow_external_strace,CyanogenMod/android_external_strace,DirtyUnicorns/android_external_strace,bigzz/strace_android,TeamExodus/external_strace,geekboxzone/lollipop_external_strace,vrastogi/strace,AOSP-YU/platform_external_strace,DirtyUnicorns/android_external_strace,Distrotech/strace,pgbovine/strace-plus,geofft/strace,vrastogi/strace,YUPlayGodDev/platform_external_strace,bnoordhuis/strace,CyanogenMod/android_external_strace,lizh06/strace-plus,jamel/strace-plus,android-ia/platform_external_strace,Infinitive-OS/platform_external_strace,kapdop/android_external_strace,kapdop/android_external_strace,DirtyUnicorns/android_external_strace,CyanogenMod/android_external_strace,lizh06/strace-plus,pgbovine/strace-plus,Infinitive-OS/platform_external_strace,lkundrak/strace,kapdop/android_external_strace,lizh06/strace-plus,MonkeyZZZZ/platform_external_strace,CyanogenMod/android_external_strace,jamel/strace-plus,xin3liang/platform_external_strace,kapdop/android_external_strace,pombredanne/strace,xin3liang/platform_external_strace,Distrotech/strace,xin3liang/platform_external_strace,android-ia/platform_external_strace,Infinitive-OS/platform_external_strace,pgbovine/strace-plus,YUPlayGodDev/platform_external_strace,AOSP-YU/platform_external_strace,Saruta/strace,Distrotech/strace,CyanogenMod/android_external_strace,cuviper/strace,YUPlayGodDev/platform_external_strace,MonkeyZZZZ/platform_external_strace,DirtyUnicorns/android_external_strace,MonkeyZZZZ/platform_external_strace,AOSP-YU/platform_external_strace,Infinitive-OS/platform_external_strace,bigzz/strace_android,lizh06/strace-plus,gcode-mirror/strace-plus,bigzz/strace_android,geekboxzone/mmallow_external_strace,jamel/strace-plus,MonkeyZZZZ/platform_external_strace,Distrotech/strace,DirtyUnicorns/android_external_strace,vrastogi/strace,YUPlayGodDev/platform_external_strace,android-ia/platform_external_strace,android-ia/platform_external_strace,geofft/strace,lkundrak/strace,gcode-mirror/strace-plus,lkundrak/strace,Infinitive-OS/platform_external_strace,MonkeyZZZZ/platform_external_strace,cuviper/strace,geofft/strace,lizh06/strace-plus,geekboxzone/lollipop_external_strace,vrastogi/strace,vrastogi/strace,AOSP-YU/platform_external_strace,geekboxzone/lollipop_external_strace,Distrotech/strace,geofft/strace,bigzz/strace_android,gcode-mirror/strace-plus,gcode-mirror/strace-plus,TeamExodus/external_strace,Saruta/strace,geekboxzone/mmallow_external_strace,Yu-AndroidM/android_external_strace,gcode-mirror/strace-plus,AOSP-YU/platform_external_strace,bnoordhuis/strace,pombredanne/strace,geofft/strace,Yu-AndroidM/android_external_strace,pgbovine/strace-plus,TeamExodus/external_strace