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 <[email protected]>
> > 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



------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to