]> granicus.if.org Git - strace/commit
Optimize tabto()
authorDenys Vlasenko <dvlasenk@redhat.com>
Wed, 24 Aug 2011 23:27:59 +0000 (01:27 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Wed, 24 Aug 2011 23:27:59 +0000 (01:27 +0200)
commit102ec4935440ff52a7fa3566154a84cc2473f16a
treeef50fdb9f911f9f141dc0c99ab7260aae50bf226
parentfabaa91ab6df17ad7367c2768a13a5d622840656
Optimize tabto()

tabto is used in many lines of strace output.
On glibc, tprintf("%*s", col - curcol, "") is noticeably slow
compared to tprintf("                 "). Use the latter.
Observed ~15% reduction of time spent in userspace.

* defs.h: Drop extern declaration of acolumn. Make tabto()
take no parameters.
* process.c (sys_exit): Call tabto() with no parameters.
* syscall.c (trace_syscall_exiting): Call tabto() with no parameters.
* strace.c: Make acolumn static, add static char *acolumn_spaces.
(main): Allocate acolumn_spaces as a string of spaces.
(printleader): Call tabto() with no parameters.
(tabto): Use simpler method to print lots of spaces.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
defs.h
process.c
strace.c
syscall.c