Bug 379438

Summary: kcachegrind duplicates calls
Product: [Developer tools] kcachegrind Reporter: Igor <igor.bondarev>
Component: generalAssignee: Josef Weidendorfer <josef.weidendorfer>
Status: ASSIGNED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 0.7.4kde   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: pictures

Description Igor 2017-05-02 13:25:45 UTC
Created attachment 105310 [details]
pictures

Hi guys!

I'm trying to understand the callgrind format and stuck with some little problem in kcachegrind.
I wrote this simple example:

events: Ir

fn=(105) func1

fn=(1) main
cfn=(105)
calls=1 1
0 1

fn=(105)
cfn=(105)
calls=5 0
0 1

In kcachegrind it looks like in pincture 1 - summary number of calls is 6. But when I double clicked on func1 it multiplicates "self calls" by 2 (pic. 2) - now there are 10 calls (but row named "called" holds normal number - 6). What is this and how I can disable this multiplication?

Thank you!
Comment 1 Josef Weidendorfer 2017-05-02 19:22:54 UTC
Thanks for the report.

The visualized call graph is a part of the full call graph,
generated on the fly both in caller and callee direction of
the selected function.

I obviously have a bug here when the selected function calls
itself recursively. The 5x call count is added to the edge two
times: once when going into caller direction and another time
when adding the callee direction.

I have to think about the correct solution here. I probably should
remember when I visited a call edge to not pass it again
in the other direction...