How to calculate the frequency of CPU cores
问题 I am trying to use RDTSC but it seems like my approach may be wrong to get the core speed: #include "stdafx.h" #include <windows.h> #include <process.h> #include <iostream> using namespace std; struct Core { int CoreNumber; }; static void startMonitoringCoreSpeeds(void *param) { Core core = *((Core *)param); SetThreadAffinityMask(GetCurrentThread(), 1 << core.CoreNumber); while (true) { DWORD64 first = __rdtsc(); Sleep(1000); DWORD64 second = __rdtsc(); cout << "Core " << core.CoreNumber << "