Re: [PATCH 2/2] tracing/function-return-tracer: Call prepare_ftrace_return by registers

From: Frédéric Weisbecker
Date: Thu Nov 13 2008 - 05:02:19 EST


2008/11/13 Ingo Molnar <mingo@xxxxxxx>:
> on a related note.
>
> Frederic, it would be nice to fine-tune the tracer output to convey
> the callgraph information more clearly. Here's a mockup of a good
> default output:
>
> getnstimeofday() {
> set_normalized_timespec() {
> clocksource_read() {
> acpi_pm_read() ( 1547 ns)
> } clocksource_read() ( 1951 ns)
> } set_normalized_timespec() ( 2200 ns)
> } getnstimeofday() ( 2354 ns)
>
> [...]


Oh yes. That would be fine. I thought such thing would be better to do
in post-processing.
But I wonder a bit about this, I explain why below.

> Such output would be _very_ nice and intuitive to have. Developers
> would love it instantly. Note its C-ish syntax - that is obviously the
> easiest to parse for kernel developers.


That's right, it's much more better for the eyes. I didn't want to
output such a disposition from the kernel
because I thought that would result in too much strings work from
kernel-space. But actually, as you suggest,
if I append a depth field in the trace that could be easy and not so
costly. I just have a last thought about
post-processing parsing. Would it make it harder for that?
Why not a flag that could be set through iter_ctrl (which has changed
its name yesterday) and that could let
the user to choose its output? That's where I renew my proposition to
make the tracers able to propose custom
flags for this file with a new callback such as tracer_ctrl, or tracer_opt.

After all perhaps an indented output would be better to build a tree
of calls from parsing. And the current
output would be better to build stats about return values and/or cost.

> and note how natural it will be in the future to embellish certain
> function calls in the above trace, for example with function
> arguments:
>
> clocksource_read("acpi_pm") {
>
> i'd suggest to hide the offset bit of the ksym (like the mockup does
> it - unless a tracing_option is set for more verbose symbol output).
> For these traces it's almost always useless and the context tells us
> in 99% of the cases where a function got called.

I think it remains useful when a function calls one other in
differents code paths.
But as you say, why not set it through a flag.

> Easiest would be to add a depth field to the trace entry as well, to
> make sure we get the right depth in the end, even if we somehow mix up
> the trace entries.


Yeah, that's good! I will just have to output "\t" * depth to have the
correct indentation.

> We could also trace function entry and exit separately, and
> post-process the call stack (and the cost) during trace output
> formatting - not during tracing.
>
> Hm?


Yes I thought about that. But with a bit post-processing, we could
retrieve the result of the normal function tracing through
the "return tracing" traces... I guess...
--
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/