📄 cpu.cpp
字号:
#include "CPU.h"
#include <tchar.h>
#include "stdafx.h"
// The CTimer class was written by Feng Yuan, and was used from his post on www.codeguru.com.
inline unsigned __int64 GetCycleCount(void)
{
_asm _emit 0x0F
_asm _emit 0x31
}
CTimer::CTimer(void)
{
m_overhead = 0;
Start();
m_overhead = Stop();
}
void CTimer::Start(void)
{
m_startcycle = GetCycleCount();
}
unsigned __int64 CTimer::Stop(void)
{
return GetCycleCount()-m_startcycle-m_overhead;
}
int CTimer::Cpu()
{
CTimer timer;
TCHAR mess[30];
int cpuspeed;
timer.Start();
Sleep(1000);
int cpuspeed10 = (int)(timer.Stop()/100000);
cpuspeed = cpuspeed10 / 10;
return cpuspeed;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -