社区
Delphi
帖子详情
如何测试CPU的速度?
hzcdc21
2002-05-10 10:28:42
在线等候!
...全文
401
9
打赏
收藏
如何测试CPU的速度?
在线等候!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Billy_Chen28
2002-05-10
打赏
举报
回复
给你一个函数
function GetCPUSpeed: Double;
const
DelayTime = 500;
var
TimerHi, TimerLo: DWORD;
PriorityClass, Priority: Integer;
begin
try
PriorityClass := GetPriorityClass(GetCurrentProcess);
Priority := GetThreadPriority(GetCurrentThread);
SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);
Sleep(10);
asm
dw 310Fh // rdtsc
mov TimerLo, eax
mov TimerHi, edx
end;
Sleep(DelayTime);
asm
dw 310Fh // rdtsc
sub eax, TimerLo
sbb edx, TimerHi
mov TimerLo, eax
mov TimerHi, edx
end;
SetThreadPriority(GetCurrentThread, Priority);
SetPriorityClass(GetCurrentProcess, PriorityClass);
Result := TimerLo / (1000.0 * DelayTime);
except
Result := 0;
end;
end;
ly_liuyang
2002-05-10
打赏
举报
回复
function GetCPUSpeed: Double;
const
DelayTime = 500; // measure time in ms
var
TimerHi, TimerLo: DWORD;
PriorityClass, Priority: Integer;
begin
PriorityClass := GetPriorityClass(GetCurrentProcess);
Priority := GetThreadPriority(GetCurrentThread);
SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
Sleep(10);
asm
dw 310Fh // rdtsc
mov TimerLo, eax
mov TimerHi, edx
end;
Sleep(DelayTime);
asm
dw 310Fh // rdtsc
sub eax, TimerLo
sbb edx, TimerHi
mov TimerLo, eax
mov TimerHi, edx
end;
SetThreadPriority(GetCurrentThread, Priority);
SetPriorityClass(GetCurrentProcess, PriorityClass);
Result := TimerLo / (1000.0 * DelayTime);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
CpuSpeedEdit.Text:=FloatToStr(GetCPUSpeed);
end;
火鸟李国平
2002-05-10
打赏
举报
回复
也来试试我
hongyou
2002-05-10
打赏
举报
回复
mark
东方小黑
2002-05-10
打赏
举报
回复
我也来试试
和码帮主
2002-05-10
打赏
举报
回复
学习
Bob7946
2002-05-10
打赏
举报
回复
一个函数:
function TForm1.GetCpuSpeed: Extended;
var
t, mhi, mlo, nhi, nlo: dword;
shr32 : comp;
begin
shr32 := 65536;
shr32 := shr32 * 65536;
t := GetTickCount;
while t = GetTickCount do ;
asm
DB 0FH,031H // rdtsc
mov mhi,edx
mov mlo,eax
end;
while GetTickCount < (t + 1000) do ;
asm
DB 0FH,031H // rdtsc
mov nhi,edx
mov nlo,eax
end;
Result := ((nhi * shr32 + nlo) - (mhi * shr32 + mlo)) / 1E6;
end;
Bob7946
2002-05-10
打赏
举报
回复
一个函数:
function TForm1.GetCpuSpeed: Extended;
var
t, mhi, mlo, nhi, nlo: dword;
shr32 : comp;
begin
shr32 := 65536;
shr32 := shr32 * 65536;
t := GetTickCount;
while t = GetTickCount do ;
asm
DB 0FH,031H // rdtsc
mov mhi,edx
mov mlo,eax
end;
while GetTickCount < (t + 1000) do ;
asm
DB 0FH,031H // rdtsc
mov nhi,edx
mov nlo,eax
end;
Result := ((nhi * shr32 + nlo) - (mhi * shr32 + mlo)) / 1E6;
end;
browmeld
2002-05-10
打赏
举报
回复
function CPUSpeed: Double;
const
DelayTime = 500; // 时间单位是毫秒
var
TimerHi, TimerLo: DWORD;
PriorityClass, Priority: Integer;
begin
PriorityClass := GetPriorityClass(GetCurrentProcess);
Priority := GetThreadPriority(GetCurrentThread);
SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
Sleep(10);
asm
dw 310Fh // rdtsc
mov TimerLo, eax
mov TimerHi, edx
end;
Sleep(DelayTime);
asm
dw 310Fh // rdtsc
sub eax, TimerLo
sbb edx, TimerHi
mov TimerLo, eax
mov TimerHi, edx
end;
SetThreadPriority(GetCurrentThread, Priority);
SetPriorityClass(GetCurrentProcess, PriorityClass);
Result := TimerLo / (1000.0 * DelayTime);
end;
如何
测试
CPU
性能?
CPU
性能
测试
方法
CPU
性能
测试
是一种用于评估计算机中央处理器性能的方法,通过比较不同
CPU
在不同任务下的表现,有助于人们选择适合需求的硬件。因此本文为大家介绍了5个
CPU
测试
性能的方法。
mac用什么软件
测试
硬盘好坏,Mac怎么
测试
硬盘
速度
?
Mac怎么
测试
硬盘
速度
?硬盘对于电脑的性能来说非常重要,因为电脑
速度
要快的话,除了
CPU
快和内存要大以外,还得看硬盘的
速度
。这也是很多小伙伴们为什么那么关心自己电脑的硬盘
速度
,下面PC6苹果网小编给大家简单...
电脑
cpu
速度
测试
软件,使用鲁大师 一键
测试
电脑的处理器(
CPU
)
速度
您可能感兴趣的话题:鲁大师核心提示:处理器(
CPU
)
速度
测试
:通过鲁大师提供的电脑性能评估算法,对用户电脑的处理器(
CPU
),以及处理器(
CPU
)同内存、主板之间的配合性能进行评估。处理器(
CPU
)
速度
测试
:通过鲁大师...
如何
测试
计算机的运行
速度
,如何查看
cpu
运行
速度
了解电脑的中央处理器...查看
cpu
运行
速度
的方法方法 1: 在Windows XP系统中查找
CPU
速度
1点击“开始”按钮,浏览并找到“我的电脑”选项,然后右键点击它。2若要在“系统属性”选项卡中查看
CPU
速度
,在右键单击“...
到底什么影响了空三建模
速度
?
CPU
还是显卡?频率还是核心?我们准备做个
测试
....
各位测绘相关的小伙伴们大家好,欢迎来到本人对测绘工程所需的非专业性电脑
测试
的系列视频。 最近测绘界风光无两的1.79亿实景三维青岛建设项目,体量规模堪称行业第一,打开了今年测绘界实景中国的风口。 倾斜摄影...
Delphi
5,929
社区成员
262,934
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章