0

I have a set of nested functions like in kernel source. I need to print parent function with opening and closing curly braces, and leaf function in a single line with semicolon similar to ftrace graph tracer. I have the current function 's name but I am not able to bring up the logic to identify the leaf function in a set of nested functions. Should I use a counter for each function entry and exit? And then how do I use that counter value? Example :

Function graph tracer

Ivid
  • 203
  • 3
  • 10
  • Could you post an example of what you're trying to achieve exactly? – Adrien Jan 26 '17 at 18:28
  • @Adrien As in above picture `__fget` is a leaf function which ftrace identifies and ends with a semicolon and not curly braces. How does it identify the leaf function? I want to print function names in a similar way. – Ivid Jan 26 '17 at 18:40
  • Let me guess, it didn't call any other function and returned. – 0andriy Jan 26 '17 at 19:56
  • 1
    `ftrace` uses **tracepoints** at the beginning of each function (I am unsure about tracepoints at the end of the function). When a *tracepoint* fires, information about that is stored in the trace: time, cpu, task, function name. This trace can be represented graphically like in the image you provide. As noted by 0andriy, leaf function is the one which doesn't call other functions (more correctly: doesn't call functions with tracepoints). – Tsyvarev Jan 26 '17 at 22:08

0 Answers0