Re: Human readable output for function return tracer

Arnaldo Carvalho de Melo
2008-11-24T18:15:35Z

Em Mon, Nov 24, 2008 at 03:39:45PM +0100, Frédéric Weisbecker escreveu:
> Hi,
>
> I'm planning to apply an idea proposed by Ingo to make the output on
> the function return tracer
> more "eyes-parsable".
> The idea consists on a trace which has flow similar to C code:
>
> func1() {
> func2() {
> func3() {
> }
> }
> func4() {
> }
> }
>
> (With time of execution added on closing braces).

I do something like that in my ctracer tool[1], take a look at one of
the callgraphs:

http://oops.ghostprotocols.net:81/ostra/dccp/tx/

To save space I the above sequence is represented as:

func1() {
func2() {
func3() 1us
} 5us
func4() 5us
} 12us

I.e. the leaf functions doesn't use {}

> The problem is that the traces arrive in the reverse order, according
> to the fact that functions
> are traced on return.
> The order corresponding to the above example would be as the following:
>
> func3, func2, func4, func1

On ctracer I didn't had this problem as I don't trace all functions,
just the ones that receive as one of its parameters a pointer to the
desired struct, and this pointer is present in all the trace buffer
entries, so as part of postprocessing it separates the callgraphs per
object.

- Arnaldo

[1] git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole.git