Re: [PATCH 2/4] ftrace - add function_duration tracer

From: Tim Bird
Date: Thu Dec 10 2009 - 17:37:54 EST


Steven Rostedt wrote:
>> I'm a little worried about this. ftrace is already an order
>> of magnitude more overhead than the previous tracer I was using.
>
> Which tracer was that? I know you used the -finstrument-functions for
> tracing before, and that has quite a bit overhead as well. The ring
> buffer has gone through a lot to speed it up.

KFT. It used -finstrument-functions, which did result in
a few more instructions per call site than mcount does. However,
the code paths in KFT are much shorter than in ftrace.
And the fact that both function exit and entry are instrumented
meant that I didn't have to do funky trampoline junk, or
manage a separate structure, in order to capture function
exit events.

It is somewhat to be expected that ftrace would have higher
overhead, because ftrace does more. But in the version
of code I was using (which is probably quite old), there
was lots of extraneous code in the hot path.
For example, there are at least 4 checks in the code
to detect whether tracing is active or not.

The ring buffer code was particularly slow. I was using
a simple fixed-size array in KFT (on a uniprocessor), and
the time to save an event was under 1 microsecond. With
ftrace on the same hardware, it costs about 6 microseconds
to save an event.
-- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/