Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

PMUinUse always fails

John_L_6
Beginner
410 Views

I have written a simple program where I get a PCM instance and call 'program()'.

PCM* m = PCM::getInstance();
std::cout << m->program() << std::endl;

My output is always 2 (PMUBusy).  I see these warnings outputted as well:

WARNING: Core 0 IA32_PERFEVTSEL0_ADDR are not zeroed 5439548
WARNING: Core 0 IA32_PERFEVTSEL0_ADDR are not zeroed 5439548

Im not entirely sure what this indicates to me.  I *think* it means that there are more than the limited number of allowed processes monitoring the PCM; though, I don't think any other process is running that is using the PCM.

0 Kudos
3 Replies
Roman_D_Intel
Employee
410 Views
Hi John, besides PCM there can be other programs using or used and not cleared hardware PMU (Performance Monitoring Unit) upon exit, that is why you see these messages. Do you run Linux or Windows? You can enfore clearing up PMU with the pcm.x/exe utility. After that try to run your code again. Thanks, Roman
0 Kudos
John_L_6
Beginner
410 Views
Hi Roman, Thanks for the quick response; that did fix things for me. I am running Linux. After a few runs I noticed my program, as well as the pcm.x utility, started returning -1 for instructions per CPU cycle and 0 for the Frequency. I notice that the Number of PCM instances climbs if I happen to 'hard kill' my program, which results in me not calling cleanup on my PCM instance. I don't know if this is the cause of these values or if there is a way to clean this up. Any Thoughts?
0 Kudos
Roman_D_Intel
Employee
410 Views
Hi John, this might be the reason. To call PCM cleanup on a normal kill or Ctrl-C or program exit you can install a handler using the "signal" system call. Please see cpucounterstest.cpp for an example. To manually reset the global PCM instance counter (in case of PCM hard kill) you can try reboot the system or do "rm /dev/shm/sem.*Intel*PCM*". Thanks, Roman
0 Kudos
Reply