Messages in this thread | | | Date | Thu, 10 Dec 2009 14:36:51 -0800 | From | Tim Bird <> | Subject | Re: [PATCH 2/4] ftrace - add function_duration tracer |
| |
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 =============================
| |