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

Using Performance Counter To Measure various parameters in External Program

Prasanna_Subburaj
734 Views

Hi,

I am using the PCM API that i downloaded from https://software.intel.com/en-us/articles/intel-performance-counter-monitor

Now i am having an program in C++ and i need to use this PCM API's Just like Intel® Performance Counter Monitor inside your programs in https://software.intel.com/en-us/articles/intel-performance-counter-monitor ;to measure various parameters after the program has executed. Please guide me on the steps of what i need to add to the new project in order to use the PCM API.

I have using Visual Studio 2013 for code development and C++ language.

Best Regards,

Prasanna

0 Kudos
5 Replies
Thomas_W_Intel
Employee
734 Views

Prasanna,

Thank you for your interest in Intel PCM. I think it is best if you start with getting pcm.x up and running. This way, you ensure that you have the right software and hardware infrastructure in place. 

You can also view pcm.x as an example for how to use the API. For example, you find code to capture the socket states and get the cache misses from them.
Apart from adding the hooks in the code, you need to link your program against the common object files (msr.o cpucounters.o pci.o client_bw.o utils.o) or create a library out of them.

Kind regards

Thomas

0 Kudos
Prasanna_Subburaj
734 Views

Hi Thomas,

Thanks for that response. Now i could link my code and run in using the project in PCM_Win folder of the package that i downloaded.

I am trying to use the -csv option to store the results into .csv for doing some analysis and i am not able to understand the arrangement of columns in the CSV file and also the data is shifted to the left as shown below.

Could you please also let me know what format does the program follow while printing the values into the CSV file. I do understand they change dynamically based on the how we call the pcm.exe file from the command prompt. Assume that i am using a default command like .\pcm.exe -csv[=test.csv].

 test1PCM.xls

PCM.jpg

Thanks,

Prasanna

0 Kudos
Thomas_W_Intel
Employee
734 Views

This looks like a bug in the CSV output. For each core, the is one column header to much. Most likely, a column header is printed for a some information that is not available on this processor. 

What kind of CPU are you using?

0 Kudos
Prasanna_Subburaj
734 Views

Ya i am also suspecting the same. By some means a column header is getting generated with out corresponding values for them. I dont where those values are getting missed.

I am using Intel i-5-3230M CPU and i am using Microsoft Visual Studio 2013 to build and run my application with PCM.

I am also using the m->getAllCounterStates(sstate2, sktstate2, cstates2); command to the states before and after my application has started and done then i am using the print_csv function to generate the PCM values.

I also have another problem. If i dont know how to reset the PMU after using the PCM module in one program and using in other program. is there any command like API available to reset the PMU before the program exits. I have attached the screen shot i got for this with this message for your reference.

 

Best Regards,

Prasanna SubburajPMU_0.jpg

0 Kudos
Roman_D_Intel
Employee
734 Views

Prasanna Subburaj wrote:

I also have another problem. If i dont know how to reset the PMU after using the PCM module in one program and using in other program. is there any command like API available to reset the PMU before the program exits. I have attached the screen shot i got for this with this message for your reference.

Please use the PCM::cleanup() API. Force reset (if needed) could be done with PCM::resetPMU().

Roman

0 Kudos
Reply