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>
diff --git a/syscall.c b/syscall.c
index 10c27d3..d1f0cf2 100644
--- a/syscall.c
+++ b/syscall.c
@@ -2334,7 +2334,7 @@
if (res != 1) {
tprintf(") ");
- tabto(acolumn);
+ tabto();
tprintf("= ? <unavailable>");
printtrailer();
tcp->flags &= ~TCB_INSYSCALL;
@@ -2359,7 +2359,7 @@
}
tprintf(") ");
- tabto(acolumn);
+ tabto();
u_error = tcp->u_error;
if (!SCNO_IN_RANGE(tcp->scno) ||
qual_flags[tcp->scno] & QUAL_RAW) {