lkml.org 
[lkml]   [2009]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][RFC] vsprintf: unify the format decoding layer for its 3 users
On Fri, 27 Feb 2009 07:19:37 +0100 Frederic Weisbecker <fweisbec@gmail.com> wrote:

>
> An new optimization is making its way to ftrace. Its purpose is to
> make ftrace_printk() consuming less memory and be faster.
>
> Written by Lai Jiangshan, the approach is to delay the formatting
> job from tracing time to output time.
> Currently, a call to ftrace_printk will format the whole string and
> insert it into the ring buffer.

It does that? eek.

> Then you can read it on /debug/tracing/trace
> file.
>
> The new implementation stores the address of the format string and
> the binary parameters into the ring buffer, making the packet more compact
> and faster to insert.
> Later, when the user exports the traces, the format string is retrieved
> with the binary parameters and the formatting job is eventually done.
>
> Here is the result of a small comparative benchmark while putting the following
> ftrace_printk on the timer interrupt. ftrace_printk is the old implementation,
> ftrace_bprintk is a the new one:
>
> ftrace_printk("This is the timer interrupt: %llu", jiffies_64);
>
> After some time running on low load (no X, no really active processes):
>
> ftrace_printk: duration average: 2044 ns, avg of bytes stored per entry: 39
> ftrace_bprintk: duration average: 1426 ns, avg of bytes stored per entry: 16
>
> Higher load (started X and launched a cat running on an X console looping on
> traces printing):
>
> ftrace_printk: duration average: 8812 ns
> ftrace_bprintk: duration average: 2611 ns
>
> Which means the new implementation can be 70 % faster on higher load.
> And it consumes lesser memory on the ring buffer.
>
> The curent implementation rewrites a lot of format decoding bits from
> vsnprintf() function, making now 3 differents functions to maintain
> in their duplicated parts of printf format decoding bits.

<looks for ftrace_bprintk() in linux-next, fails>

Why does the current ftrace_bprintk() need to hack around in (or
duplicate) vprintk() internals? It's a bit grubby, but by placing an
upper bound on the number of args, it could simply call vscnprintf()
directly?



\
 
 \ /
  Last update: 2009-02-27 07:49    [from the cache]
©2003-2011 Jasper Spaans