I need to find out how many CPU cores a given process has executed on during a certain time e.g 1 second or so?
This has to be done from a C program (or possibly C++). I know that perf presents the number of cpu-migrations.
I need to know the number of CPU core swaps and also which cores the process has used. I assume that I first have to get which threads the process executes in and then to see what cores the threads run on.
The information I get is to be used to calculate the CPU load for a process. When running in only one CPU core I know how to do and have a working solution. However, handling several CPU cores that a process consisting of several threads that run in one or several CPU cores at different times makes it harder. Is there any solution or hint to solution anyone here could point at?