sol
sol

Reputation: 93

Difference in perf and Intel PCM

I know both Intels PCM and perf are available, do they use the same hardware counters?? However perfs raw h/w events are not clear and Intel`s PCM provides much more functionality. Can I use PCM to somehow monitor individual process like perf ?? I know that this can be done on VTune but it is proprietary. I am currently working on ubuntu 12.04.

Upvotes: 3

Views: 2311

Answers (2)

L.Y.
L.Y.

Reputation: 21

It is more lightweight to use wrmsr to program different MSRs to select a specific event and set a mode (e.g. core-level or logical-processor-level/thread-level) and then use rdpmc/rdmsr to read counters before and after the codes you want to monitor. Since it doesn't need to go into kernel-mode and out of kernel-mode from/to user-mode which is costly and especially harmful for timing event monitoring, but you need root privilege if you use wrmsr instruction for programming MSR. If you use perf_event_open, then it doesn't matter. What's more, linux perf subsystem does more work on supporting per-thread monitoring (e.g. save/restore counting register during context-switch in some mode). If you want to learn more, I suggest you read the chapter 18 and 19 in Intel ® 64 and IA-32 Architectures Software Developer ’s Manual Volume 3B : System Programming Guide , Part 2 or go to the Intel developer forums, and see the man pages about perf_event_open

As far as I know, if you intent to use PCM to somehow monitor individual process like perf, it depends. They are actually same both utilizing the same hardware PMU which collisions may happen.

Upvotes: 1

Manuel Selva
Manuel Selva

Reputation: 19050

They both use the same piece of hardware called PMU, performance monitoring unit. The PMU provides many hardware counters, and which hardware counter is used depend on the parameter you give to your tool.

The perf userland tool is built on top a kernel system call called perf_event_open where as the Intel PCM tool is built on top of the msr kernel module, that allow to access model specific registers.

I am not sure, but I think that Intel PCM is not a command line tool but a C++ API that you may use inside your programs.

Upvotes: 3

Related Questions