请教cpu的测试办法

suntao222 2004-07-30 10:50:28
要求测试:
cpu 32bit register read/write
cpu 32bit stack instruction
cpu 32bit data access through FS GS
cpu 32bit extend flag instruction
cpu 32bit multiplication
cpu protected mode entry instruction
cpu speed test
cpu protected mode test ->a20 line, protected mode instructions
只要能给出有关资料就好,比如如何进行32位寄存器的读写,如何进行保护模式下指令的测试,所有测试在dos下进行
...全文
98 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
danielzhu 2004-07-30
  • 打赏
  • 举报
回复
UP
aspnetwuxueyou 2004-07-30
  • 打赏
  • 举报
回复
Get cpu speed
aspnetwuxueyou 2004-07-30
  • 打赏
  • 举报
回复
#define STRICT
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <tchar.h>

#include "timer.h"

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR lpCmd, int nShow)
{
KTimer timer;
TCHAR mess[128];

timer.Start();
Sleep(1000);
unsigned cpuspeed10 = (unsigned)( timer.Stop() / 100000 );

timer.Start();
CreateSolidBrush(RGB(0xAA, 0xAA, 0xAA));
unsigned time = (unsigned)timer.Stop();

wsprintf(mess, _T("CPU speed %d.%d mhz\n")
_T("KTimer overhead %d clock cycles\n")
_T("CreateSolidBrush %d clock cycles %d ns"),
cpuspeed10 / 10, cpuspeed10 % 10,
(unsigned) timer.m_overhead,
time, time * 10000 / cpuspeed10);

MessageBox(NULL, mess, _T("How fast is GDI?"), MB_OK);

return 0;
}
aspnetwuxueyou 2004-07-30
  • 打赏
  • 举报
回复
#pragma once

inline unsigned __int64 GetCycleCount(void)
{
_asm _emit 0x0F
_asm _emit 0x31
}

class KTimer
{
unsigned __int64 m_startcycle;
public:
unsigned __int64 m_overhead;

KTimer(void)
{
m_overhead = 0;
Start();
m_overhead = Stop();
}

void Start(void)
{
m_startcycle = GetCycleCount();
}

unsigned __int64 Stop(void)
{
return GetCycleCount() - m_startcycle - m_overhead;
}
};
leon_z 2004-07-30
  • 打赏
  • 举报
回复
在DOS 不是可以直接用 汇编读写这些东东吗

16,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧