How to interpret results from kcachegrind
Asked Answered
D

1

28

Could anyone tell me how to interest the results from kcachegrind.

I had two versions of my code (v1, v2) both compiled in debug mode. I ran them through valgrind with options:

valgrind --tool=callgrind -v ....

The output files thus generated are opened in kcachegrind. Now I already found the version v2 of the code runs more faster than first version, v1 as it meant to be. But how do i inperet a result from kcachegrind's call graph.

In kcachegrind All Callers tab, I have the following columns: Incl. , Distance, Called, Caller.

IIUC, Called and caller are the no of times the 'caller' was called in the program. But I dont know about others.

Another thing is when selecting a particular function and then the 'callers' tab it shows some more information. Ir, Ir per call, count, caller and in the types tab: `EventType, Incl. Self, short, Formula.

I dont have any idea here.

So far I had read these questions:

KCachegrind interpretation confusion Confused about profiling result

Damarisdamarra answered 21/5, 2014 at 14:27 Comment(0)
C
32

I use QCacheGrind, so I apologize if something on my screen isn't quite the same as what you see. From what I understand, QCacheGrind is a direct Qt port of KCacheGrind. Additionally, I have the ability to toggle between an Instruction Count and a % of total instructions. For consistency I will refer to the Instruction Count view on any column that can be toggled in this way.

The "All Callers" tab columns should represent the following:

  • Incl.: The number of instructions that this function generated as a whole broken down by each caller. Because callers are a hierarchy (hence the distance column) there may be several that have the same value if your call stack is deep.

  • Distance: How many function calls separated is the selected line from the function that is selected in the Flat Profile panel.

  • Called: The number of time the Caller called the a function that ultimately led to the execution of the selected function).

  • Caller: The function that directly called or called another caller of your selected function (as determined by Distance).

The Callers tab is more straightforward. It shows the functions that have a distance of 1 from your selected function. In other words, these are the functions that directly invoke your selected function.

  • Ir: The number of instructions executed in total by the selected function after being called by this caller.

  • Ir per call: The number of instructions executed per call.

  • Count: The number of times the selected function was called by the caller.

  • Caller: The function that directly called the selected function.

For Events, see this page for the handbook. I suspect that if you didn't define your own types all you should see is "Instruction Fetch" and possibly "Cycle Estimation." The quick breakdown on these columns is as follows:

  • Incl.: Again the total instructions performed by this function and all functions it calls beneath it.

  • Self: The instructions performed exclusively by this function. This counter only tracks instructions used by this function, not any instruction used by functions that are called by this function.

  • Short and Formula: These columns are used when defining a custom Event Type. Yours should either be blank or very short (like CEst = Ir) unless you end up defining your own Types.

Comate answered 10/6, 2018 at 7:1 Comment(2)
The link to the handbook is dead.Annulose
I guess this is the link @Damarisdamarra referred to: docs.kde.org/trunk5/en/kcachegrind/kcachegrind/…Negligee

© 2022 - 2024 — McMap. All rights reserved.