I working on a small testing/monitoring tool for the CPU. It uses an OpenHardwareMonitor and Timer to poll the system and obtain CPU temp, frequency, PPT, etc., and also can benchmark the CPU. When I run the single-core test, I set affinity to a particular core, and this is where the problem arises. The monitoring stalls while the core that being tested is at full load, despite the rest of the cores are idling, means, it sets the affinity for the entire program. I use ThreadAffinity to cycle through the cores:
Thread.BeginThreadAffinity();
SetThreadAffinityMask(GetCurrentThread(), new IntPtr(intptrVal));
PiTest();
Thread.EndThreadAffinity();
I also tried to make methods async, but it doesn't resolve the issue. Is there any way to set a benchmark method to the particular core that is being tested right now, while allowing the rest of the program, including monitoring timer/method to use any other core? If not, how it can be resolved in another way?