Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Intel PCM APIs Question

Spivoler
Beginner
997 Views

Hi,

I am a new user of Intel PCM tool. When I was trying to use PCM APIs in my c++ application, I kinda stuck at the very beginning. I think the error might be caused by failing of linking libraries or including headers. But I just followed the example given by PCM articles... Here is what I did and got...

I just faked a very simple example (test.cc):

#include "cpucounters.h"

void main(){
  PCM * m = PCM::getInstance();
  PCM::ErrorCode returnResult = m->program();
  if (returnResult != PCM::Success){
     std::cerr << "Intel's PCM couldn't start" << std::endl;
     std::cerr << "Error code: " << returnResult << std::endl;
     exit(1);
  }

  SystemCounterState before_sstate = getSystemCounterState();

  SystemCounterState after_sstate = getSystemCounterState();

  std::cout << "Instructions per clock:" << getIPC(before_sstate,after_sstate) << std::endl;
  std::cout << "Bytes read:" << getBytesReadFromMC(before_sstate,after_sstate) <cleanup();
}

 

Then I did the compilation work by:

 

g++ -I. cpucounters.o msr.o pci.o test.cc

Since I put the file test.cc in the root directory of PCM, I did not put any prefix before object files. When I compile, I got errors as below:

In file included from cpucounters.h:34,
                 from test.cc:1:
msr.h:67: error: ISO C++ forbids declaration of ‘shared_ptr’ with no type
msr.h:67: error: invalid use of ‘::’
msr.h:67: error: expected ‘;’ before ‘<’ token
msr.h: In constructor ‘SafeMsrHandle::SafeMsrHandle(uint32)’:
msr.h:76: error: class ‘SafeMsrHandle’ does not have any field named ‘pHandle’
msr.h: In member function ‘int32 SafeMsrHandle::read(uint64, uint64*)’:
msr.h:82: error: ‘pHandle’ was not declared in this scope
msr.h: In member function ‘int32 SafeMsrHandle::write(uint64, uint64)’:
msr.h:92: error: ‘pHandle’ was not declared in this scope
msr.h: In member function ‘int32 SafeMsrHandle::getCoreId()’:
msr.h:99: error: ‘pHandle’ was not declared in this scope
In file included from cpucounters.h:37,
                 from test.cc:1:
width_extender.h: At global scope:
width_extender.h:54: error: ISO C++ forbids declaration of ‘shared_ptr’ with no type
width_extender.h:54: error: invalid use of ‘::’
width_extender.h:54: error: expected ‘;’ before ‘<’ token
width_extender.h:56: error: expected ‘)’ before ‘<’ token
width_extender.h:67: error: ISO C++ forbids declaration of ‘shared_ptr’ with no type
width_extender.h:67: error: invalid use of ‘::’
.......

 

Can anyone help me with this? Thanks.

 

0 Kudos
2 Replies
Roman_D_Intel
Employee
997 Views

Hi,

the latest version of PCM also needs  -std=c++0x option. For all other options you can consult the PCM Makefile.

Thanks,

Roman

0 Kudos
Spivoler
Beginner
997 Views

Roman Dementiev (Intel) wrote:

Hi,

the latest version of PCM also needs  -std=c++0x option. For all other options you can consult the PCM Makefile.

Thanks,

Roman

Thanks, Roman. I will try that out and other details in Makefile.

0 Kudos
Reply