Kcachegrind loop evaluation

Going to the github page and seeing that in some kind of pdf file written on the kde docs website, I was still confused. Suppose that in the test code these two lines:

double a1 {asinh(1 / ep)};                   // 5 instr.
double b1 {log((1 + sqrt(1 + ep*ep)) / ep)}; // 12 instr.

where epis some value that can be predetermined. My comments are made in Codeblocks by launching a debugger with a disassembler, then patiently pressing the "next instruction" and counting. They correspond to what Kachachegrind says, if I installed it to show “Command order”. I suppose this should make sense (I'm new to C ++, by the way). But if I switch to "Cycle Evaluation," I get very strange readings. In the current example, this 115, and 122, but other seemingly similar expressions, such as:

double Ap {1.0};
double ep {0.9};

show 222and 2(instr. fetch shows 2for both)! What's going on here? Can someone explain?

+4
source share
1 answer

I think I found the answer after many clicks and got used to Kcachegrind more. The general “cycle estimate" uses this formula:

CEst = Ir + 10 L1m + 100 LLm

Where

Ir  = Instruction Fetch
L1m = L1 Miss Sum
Llm = Last-level Miss Sum

So, for my case, where I CEstshowed 2and 222, but 2 Ireach, the first of them had 2samples of teams and no misses, while the other had a team 2but also two misses of each, =>

2*Ir + 10*2*L1m + 100*2*Llm = 2 + 20 + 200 = 222

This is consistent across all the codes I've tried.

+4
source

All Articles