[SCM] strace branch, master, updated. v4.6-115-g102ec49
Dmitry V. Levin
ldv at altlinux.org
Tue Aug 30 16:20:22 UTC 2011
On Wed, Aug 24, 2011 at 11:41:10PM +0000, Denys Vlasenko wrote:
> commit 102ec4935440ff52a7fa3566154a84cc2473f16a
> Author: Denys Vlasenko <dvlasenk at redhat.com>
> Date: Thu Aug 25 01:27:59 2011 +0200
>
> 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.
[...]
> void
> -tabto(int col)
> +tabto(void)
> {
> - if (curcol < col)
> - tprintf("%*s", col - curcol, "");
> + if (curcol < acolumn)
> + tprintf(acolumn_spaces + curcol);
> }
The new statement yields a warning:
strace.c: In function 'tabto':
strace.c:2701:3: warning: format not a string literal and no format arguments
Maybe we could use
tprintf("%s", acolumn_spaces + curcol);
instead without performance degradation?
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20110830/aef53905/attachment.bin>
More information about the Strace-devel
mailing list