[SCM] strace branch, master, updated. v4.6-115-g102ec49

Denys Vlasenko dvlasenk at redhat.com
Wed Aug 31 12:04:52 UTC 2011


On Tue, 2011-08-30 at 20:20 +0400, Dmitry V. Levin wrote:
> 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

Pity, my toolchain doesn't emit that... I can't detect these warnings.

> Maybe we could use
> 		tprintf("%s", acolumn_spaces + curcol);
> instead without performance degradation?

There will be some performance degradation.
Is there a way to suppress this warning on a case-by-case basis?

-- 
vda






More information about the Strace-devel mailing list