Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i access the Intel CPU Counter

Is there any small tool that gives me access to the data gathered by the Intel CPU Counters (like L1/L2 cache misses, branch prediction failures ... you know there are hunderts of them on modern Core2 CPU's).

It must work on Windows (while being able to use it with Solaris, FreeBSD, Linux, MacOSX would of course be nice).

like image 867
Lothar Avatar asked Aug 12 '09 13:08

Lothar


People also ask

What is Intel PCM?

Intel® Performance Counter Monitor (Intel® PCM) is an application programming interface (API) and a set of tools based on the API to monitor performance and energy metrics of Intel® Core™, Xeon®, Atom™ and Xeon Phi™ processors. PCM works on Linux, Windows, Mac OS X, FreeBSD, DragonFlyBSD and ChromeOS operating systems.

Which of the following are measured by performance counters?

Performance counters are bits of code that monitor, count, or measure events in software, which allow us to see patterns from a high-level view. They are registered with the operating system during installation of the software, allowing anyone with the proper permissions to view them.


2 Answers

Check out the Intel PCM (Performance Counter Monitor) tool which does exactly what you want to do.

Link: https://software.intel.com/en-us/articles/intel-performance-counter-monitor-a-better-way-to-measure-cpu-utilization

Intel PCM provides a rich API that allows you to instrument your code. Furthermore, to date, PCM is the only tool to read uncore events too.

like image 150
Shailen Avatar answered Sep 24 '22 07:09

Shailen


This thread seems a little old but if you're still interested, I wrote a howto recently on this topic using nothing more than rdmsr and wrmsr in Linux. It only deals with the performance counters on an Intel uncore for Westmere, but the process I described might help you figure out what you need if you haven't already. I'm sure Windows has some equivalent program or function call to RDMSR and WRMSR. The problem is you need to be ring 0 (kernel mode) to read MSRs. I have no idea how to do that in Windows. I won't be able to help with any Windows questions but may be able to answer some MSR-related questions if you have any. I'm by no means an expert though.

like image 32
ryancox0 Avatar answered Sep 25 '22 07:09

ryancox0