Skip to content

Commit 2fe6821

Browse files
ogbrugge-workopcm
authored andcommitted
Zero regs array, add warning in case no custom event provided
Change-Id: Ifa6730e2a544cab863dd23d1be31e6f0d670dbea
1 parent cdef1df commit 2fe6821

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pcm-core.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ int main(int argc, char * argv[])
295295
bool show_partial_core_output = false;
296296
std::bitset<MAX_CORES> ycores;
297297

298+
// Occasionally the memory is not properly nulled because counters appear to
299+
// be programmed even without given arguments so making really sure
300+
memset( &regs, 0, sizeof(regs) );
301+
298302
conf.fixedCfg = NULL; // default
299303
conf.nGPCounters = 4;
300304
conf.gpCounterCfg = regs;
@@ -432,7 +436,10 @@ int main(int argc, char * argv[])
432436
}
433437
continue;
434438
}
435-
} while(argc > 1); // end of command line partsing loop
439+
} while(argc > 1); // end of command line parsing loop
440+
441+
if ( cur_event == 0 )
442+
cerr << "WARNING: you did not provide any custom events, is this intentional?\n";
436443

437444
conf.OffcoreResponseMsrValue[0] = events[0].msr_value;
438445
conf.OffcoreResponseMsrValue[1] = events[1].msr_value;

0 commit comments

Comments
 (0)