Open honggyukim opened 2 years ago
I want to try this one!
@daeroro Thanks. But it'd be much easier to do #1499 first.
@honggyukim Thank you. I'll try #1499 first.
I'll try this.
Thanks. Please keep in mind that this can be applied to mermaid result as well so we need to have a common routine that combines the related edges.
Thanks for the advice. I'll also consider the impact on mermaid functionality.
Hi, I have been looking into this issue for the past few days and I think I know the root of the problem, but I don't really know how to fix this. As mentioned intially, there are multiple fib
nodes since there are multiple call paths. Seems like tracking such multiple call paths are done by add_graph_entry()
through changing the pointer for the tg->node
:
out:
node->nr_calls++;
tg->node = node;
and by add_graph_exit()
, again changing the pointer for the tg->node
:
out:
node->time += fstack->total_time;
node->child_time += fstack->child_time;
if (exit_cb)
exit_cb(tg, cb_arg);
tg->node = node->parent;
If I am not wrong, tg->node
is therefore decided by how many UFTRACE_ENTRY
and UFTRACE_EXIT
are encountered in the dump file. So I thought about changing this logic to not have a different fib
node for every different call path, but then it would not make a proper graph in the first place. My thoughts are either:
bool recursive
to denote that it is a node of recursive calls, and skip any of the prints regarding recursive calls during print_graph_to_graphviz()
,@gichoel told me that the latter would create significant overhead if the initial graph is extremely large in size. Maybe the former idea could work, but I wanted some feedback if there are any better ideas.
I think the first approach would work if you can count the number of recursive calls correctly.
uftrace graph
actually doesn't show a call graph, but just a call tree output. For example,t-fibonacci
example's output is as follows.As the output shows there are multiple nodes for
fib
function. It's because there are multiple backtrace or call paths of eachfib
node.The
--graphviz
output also uses the same logic when building a graph, precisely a tree. So its output doesn't show the multiple nodes for the same function, but it draws multiple edges for the same calls.The
--graphviz
output oft-fibonacci
is as follows.Its image shows too many edges from
fib
tofib
as follows.But it would be much better to make it as follows.
This modified dot produces much clear image as follows.