|
From: <sv...@va...> - 2012-11-19 22:05:14
|
weidendo 2012-11-19 22:05:06 +0000 (Mon, 19 Nov 2012)
New Revision: 13130
Log:
Callgrind: fix Ir cost update for ignored functions
Also without cache simulation, Callgrind maintains Ir cost.
This is done in setup_bbcc by incrementing an execution counter
for last_bbcc (the cost center for the previously executed BB
in current context) and the global cost counter.
However, we forgot to increment any counter if the currently
executing function should be ignored. We need to still update
costs, add attribute this to a not-ignored call site (as
given in CLG_(current_state).nonskipped).
Before this fix, there was a difference in Ir cost with vs. without
cache simulation. This was because ignored functions (e.g. PLT code)
contributed no cost when not doing cache simulation.
Modified files:
trunk/callgrind/bbcc.c
Modified: trunk/callgrind/bbcc.c (+14 -5)
===================================================================
--- trunk/callgrind/bbcc.c 2012-11-19 15:12:07 +00:00 (rev 13129)
+++ trunk/callgrind/bbcc.c 2012-11-19 22:05:06 +00:00 (rev 13130)
@@ -594,11 +594,8 @@
jmpkind = last_bb->jmp[passed].jmpkind;
isConditionalJump = (passed < last_bb->cjmp_count);
- /* if we are in a function which is skipped in the call graph, we
- * do not increment the exe counter to produce cost (if simulation off),
- * which would lead to dumping this BB to be skipped
- */
- if (CLG_(current_state).collect && !CLG_(current_state).nonskipped) {
+ if (CLG_(current_state).collect) {
+ if (!CLG_(current_state).nonskipped) {
last_bbcc->ecounter_sum++;
last_bbcc->jmp[passed].ecounter++;
if (!CLG_(clo).simulate_cache) {
@@ -606,6 +603,18 @@
UInt instr_count = last_bb->jmp[passed].instr+1;
CLG_(current_state).cost[ fullOffset(EG_IR) ] += instr_count;
}
+ }
+ else {
+ /* do not increment exe counter of BBs in skipped functions, as it
+ * would fool dumping code */
+ if (!CLG_(clo).simulate_cache) {
+ /* update Ir cost */
+ UInt instr_count = last_bb->jmp[passed].instr+1;
+ CLG_(current_state).cost[ fullOffset(EG_IR) ] += instr_count;
+ CLG_(current_state).nonskipped->skipped[ fullOffset(EG_IR) ]
+ += instr_count;
+ }
+ }
}
CLG_DEBUGIF(4) {
|