Re: [PATCH 0/11] LTTng-core (basic tracing infrastructure) 0.5.108

Karim Yaghmour
2006-09-14T18:15:18Z

Ingo Molnar wrote:
> but that's not how a fair chunk of people want to use tracing. People
> (enterprise customers trying to figure out performance problems,
> engineers trying to debug things on a live, production system) want to
> be able to insert a tracepoint anywhere and anytime - and also they want
> to have zero overhead from tracing if no tracepoints are used on a
> system.

This is an implementation issue. You can easily have it so that at
the site of a marker you generate some code in a special "trace"
section of the binary which does the actual tracing and insert
noops at the marker site. Therefore the only penalty until the
tracing is enabled is the execution of additional noops.

[ note: this comes from a suggestion made by Hiramatsu-san at
this year's OLS. ]

> wrong: the original demo tracepoints that came with SystemTap still work
> on the current kernel, because the 'coupling' is loose: based on
> function names.
>
> Static tracepoints on the other hand, if added via an external patch, do
> depend on the target function not moving around and the context of the
> tracepoint not being changed. (and static tracepoints if in the source
> all the time are a constant hindrance to development and code
> readability.)

Instrumentation of function boundaries is usually not much of an issue.
Instrumentation of key events, though, is different. Here's the classic:
@@ -1709,6 +1712,7 @@ switch_tasks:
++*switch_count;

prepare_arch_switch(rq, next);
+ TRACE_SCHEDCHANGE(prev, next);
prev = context_switch(rq, prev, next);
barrier();

This is the kind of thing for which the instrumentation, be it static
or dynamic, requires some kind of intelligent analysis of where to
get the info. Now, answer honestly, wouldn't it be simpler to have
such an event marker instead of having to figure out for every kernel
binary you get where the darned probe needs to be inserted?

Karim