static double CalcCpuSpeed() { DWORD clock1 = 0; DWORD clock2 = 0; TIMESNAP(clock1); double seconds = SpinWait(0.1); TIMESNAP(clock2); double clocks = clock2 - clock1; return (clocks/seconds); }
static unsigned int ProgsTimer(void) { unsigned int c; unsigned int cycleCount; static unsigned int cycleTimer; TIMESNAP(c); if(cycleTimer > c) { cycleCount = ((unsigned int)0xffffffff-(cycleTimer-c)); } else { cycleCount = c-cycleTimer; } cycleTimer = c; return cycleCount>>8; }