Am 13.03.2013 16:58, schrieb Farah Saab Gmail:
> Hello,
>
> How do I get the number of loops in a function shown in Kcachegrind?
> Is it enough to press the button "Cycle Detection"?

No, that is something totally different (it's about correct
calculation of inclusive costs, and that needs detection of recursive
function calls = cycles in the call graph).

What do you mean by "number of loops in a function" ?
How often the loop body was executed for a given loop construct on
the source level?

It's a little tricky because Valgrind does not see loops. It just sees
jumps in the machine code. KCachegrind can show how often a jump
was executed, but you have to understand that the compiler can do 
optimizations such as loop unrolling, such that the loop trip count
does not relate to any jump counts.

This said, you should run your code with Callgrind options
"--dump-instr=yes --collect-jumps=yes". Then, machine code
annotation in KCachegrind does show jump arcs, and how often
(conditional) jumps were executed.


Josef


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to