Processors
Intel® Processors, Tools, and Utilities
14533 Discussions

Intel Performance Counters - Measuring on All Cores

idata
Employee
1,730 Views

Hi,

I have an Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz with with 10 cores.

My questions are :

First Question

Can I measure all performance counters on all cores regardless of executing threads or processes. For example :

Process 1 : Start Recording Performance Counters

Process 2 with its Threads -- Execute and Finish

Process 3 with its Threads -- Execute and Finish

Process 1 : Read performance Counter Values that caused by other thread are processes

Second Question

In Multi-threaded application, each thread wants to measure its own performance counters. However, OS might does switch between threads.

Does this cause an overlap in performance counters ? When a thread gets kicked out of the CPU, what happens to its performance counter recorded so far ? Does OS save that and put it back when thread is re-scheduled ?

What is the best way to handle this situation ?

0 Kudos
3 Replies
idata
Employee
251 Views

Hello, kmahmou1.

 

 

Thank you very much for sharing your issue with the Intel® Communities Team.

 

 

In order for me to provide you with more accurate information, I would like to confirm if this information that you are requesting is to develop any type of software or a type of configuration that you would like to set to an OS?

 

 

 

Antony S.
0 Kudos
idata
Employee
251 Views

I am ***not*** requesting to develop a new hardware or feature. My question is specific to Performance Counters. To put more into context, examples of performance counters are : "Number of Branch Instructions" or "Number of Mis Predicted Branch Instructions". And I am using the "libpfm-4.8.0" library.

 

To be more specific ... I am reading from : Intel 64 and IA32 Architectures Software Developer's Manual -- Volume 3 (3A, 3B, 3C & 3D) - Systems Programming Guide Chapters 18 and 19 related to performance counters.

I have an application with multiple threads that I want to measure performance counters with for all threads or for each thread separately.

Rephrasing questions:

1- Thread A start executing. When it starts, it requests the core to start recording performance counters. However, before it gets a chance to read the values (Either through overflow or direct reading ... It gets scheduled out by the operating system. How does this affect its performance counters ? Will they be wiped out? Are they going to interleave with other threads ?

2- I saw in the Intel user manual that I can set a field in the performance counter registers (ANYTHREAD=1), which means it will accumulate counts from all other threads. I am asking about a scenario here ...

Can I start a new process .... on core CPU-1 Core-1, start recording performance counters with (ANYTHREAD=1) and then start let's billion threads on the same CPU and Core CPU-1, Core-1. Once they finish, I can let original process read them ?

These poorly explained in the manuals .....

0 Kudos
idata
Employee
251 Views

Hello, kmahmou1.

 

 

Thank you very much for your prompt reply and the detailed information provided.

 

In this case, for us to assist you better and provide you with more accurate information, please share this question in the https://software.intel.com/en-us/forum Intel® Developer Zone Forums and one of our specialists will be able to provide you with further assistance.

 

 

 

Antony S.
0 Kudos
Reply