Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pcm-core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extern "C" {
SystemCounterState SysBeforeState, SysAfterState;
std::vector<CoreCounterState> BeforeState, AfterState;
std::vector<SocketCounterState> DummySocketStates;
EventSelectRegister regs[4];
EventSelectRegister regs[PERF_MAX_COUNTERS];
PCM::ExtendedCustomCoreEventDescription conf;

int pcm_c_build_core_event(uint8_t idx, const char * argv)
Expand Down Expand Up @@ -290,16 +290,12 @@ int main(int argc, char * argv[])
int calibrated = PCM_CALIBRATION_INTERVAL - 2; // keeps track is the clock calibration needed
unsigned int numberOfIterations = 0; // number of iterations
string program = string(argv[0]);
EventSelectRegister regs[4];
EventSelectRegister regs[PERF_MAX_COUNTERS];
PCM::ExtendedCustomCoreEventDescription conf;
bool show_partial_core_output = false;
std::bitset<MAX_CORES> ycores;

// Occasionally the memory is not properly nulled because counters appear to
// be programmed even without given arguments so making really sure
memset( &regs, 0, sizeof(regs) );

PCM * m = PCM::getInstance();
PCM * m = PCM::getInstance();

conf.fixedCfg = NULL; // default
conf.nGPCounters = m->getMaxCustomCoreEvents();
Expand Down
6 changes: 5 additions & 1 deletion types.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ typedef signed int int32;
#define IA32_PERFEVTSEL2_ADDR (IA32_PERFEVTSEL0_ADDR + 2)
#define IA32_PERFEVTSEL3_ADDR (IA32_PERFEVTSEL0_ADDR + 3)

#define PERF_MAX_COUNTERS (11)
#define PERF_MAX_FIXED_COUNTERS (3)
#define PERF_MAX_CUSTOM_COUNTERS (8)
#define PERF_MAX_COUNTERS (PERF_MAX_FIXED_COUNTERS + PERF_MAX_CUSTOM_COUNTERS)

#define IA32_DEBUGCTL (0x1D9)

Expand Down Expand Up @@ -319,6 +321,8 @@ struct EventSelectRegister
} fields;
uint64 value;
};

EventSelectRegister() : value(0) {}
};


Expand Down