Example #1
0
void pcmInit() {
  std::cout << "Initializing PCM" << std::endl;
  PCM* m = PCM::getInstance();
  m->disableJKTWorkaround();
  
  switch( m->program() ) { 
    case PCM::Success:
      std::cout << "PCM Initialized" << std::endl;
			return;
  
    case PCM::PMUBusy:
      std::cout << "PCM::PMU Busy!" << std::endl;
      m->resetPMU();
			return;
  
    default:
      return;
	}
}
Example #2
0
int32_t initpcm() {

	int ret = -1;
	PCM *m = PCM::getInstance();

	PCM::CustomCoreEventDescription para[4];

	if (m != NULL) {
		para[0].event_number = MEM_UOP_RETIRED;
		para[0].umask_value = LOADS;

		para[1].event_number = MEM_LOAD_UOPS_RETIRED_EVENT;
		para[1].umask_value = L1_HIT;

		para[2].event_number = MEM_LOAD_UOPS_RETIRED_EVENT;
		para[2].umask_value = L2_HIT;

		para[3].event_number = MEM_LOAD_UOPS_RETIRED_EVENT;
		para[3].umask_value = LLC_HIT;

		ret = m->program(PCM::CUSTOM_CORE_EVENTS, para);
	}
	return ret;
}