社区
Delphi
帖子详情
如何测试CPU的速度?
hzcdc21
2002-05-10 10:28:42
在线等候!
...全文
395
9
打赏
收藏
如何测试CPU的速度?
在线等候!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用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
运行
速度
的方法方法 1: 在Windows XP系统中查找
CPU
速度
1点击“开始”按钮,浏览并找到“我的电脑”选项,然后右键点击它。2若要在“系统属性”选项卡中查看
CPU
速度
,在右键单击“...
软件
测试
cpu
性能
测试
案例,
cpu
测试
(
cpu
性能
测试
软件)
目前大部分人都使用
cpu
-z或者aida64软件,其它的我不太清楚,aida是一款比较全面性的软件,可以检查电脑所有硬件参数,性能,型号,还能检测硬件温度,准确性很....压力
测试
压力
测试
本来就是测
CPU
负载压力,没有100%...
处理器
cpu
测试
工具
专门用于访存性能的
测试
工具STREAM,用来
测试
CPU
对内存的访问
速度
。这个工具运行时会对内存发起大量数据请求,如果数据在更短时间内完成传输,则代表访存性能更高。 针对嵌入式的EEMBC: 该软件非常简单,数据量...
Delphi
5,386
社区成员
262,729
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章