I should made a separated program named "cpu timer" with the same numbers of threads than cores that makes a simple operation in a loop. Every second its stop to advises how many sums have you performed in every 4 threads.
Then run your app, then it stores the sums/threads without your app running.
Then throw your app, so the performance of the "cpu timer" will be lower, so you can display the performance of every thread again initial values.
You should have some error because windows system maintenance will run another threads
You will have a problem, because when the main processor heats up it can run at slower speed so you should read the cpu clock speed also to take it in account.
The code could be something like this:
Every thread:
cout<<"Wait a second, please\n";
long count,sum=0;auto time0=clock()/CLOCKS_PER_SEC,time=time0;
for (count=0;;count++)
{
time=clock();if (time/CLOCKS_PER_SEC>time0) break;
}
long performance_before=count;
cout<<"Now you can throw your app, please\n";
while(1)
{
for (count=0;;count++)
{
time=clock();if (time/CLOCKS_PER_SEC>time0) break;
}
cout<<"Thread num percentage occupancy="<<100.0*count/performance_before<<" ./.\n";
}