社区
Delphi
帖子详情
如何测试CPU的速度?
hzcdc21
2002-05-10 10:28:42
在线等候!
...全文
435
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
的L1~L3级缓存和内存的读取
速度
测试
在许多文章中指出
CPU
的L1~3和内存的缓存的架构,
速度
差异等。纸上得来终觉浅,今天想实际写代码简单
测试
一下。
APP性能
测试
(启动
速度
、内存、
CPU
、FPS、GPU、耗电量)
文章目录启动
速度
内存
CPU
FPS(应用的使用流畅度)GPU渲染耗电量 启动
速度
测试
内容 冷启动
速度
热启动
速度
完全启动
速度
有网启动
速度
无网启动
速度
主要
测试
冷启动和热启动
测试
标准
测试
标准:冷启动时间不超过1.5s, 热启动不超过1s
测试
方法 方法1:通过FFmpeg录屏拆帧 https://ffmpeg.zeranoe.com/builds/官网 https://w...
电脑
cpu
速度
测试
软件,使用鲁大师 一键
测试
电脑的处理器(
CPU
)
速度
您可能感兴趣的话题:鲁大师核心提示:处理器(
CPU
)
速度
测试
:通过鲁大师提供的电脑性能评估算法,对用户电脑的处理器(
CPU
),以及处理器(
CPU
)同内存、主板之间的配合性能进行评估。处理器(
CPU
)
速度
测试
:通过鲁大师提供的电脑性能评估算法,对用户电脑的处理器(
CPU
),以及处理器(
CPU
)同内存、主板之间的配合性能进行评估。完成
测试
后您可以通过点击“处理器
速度
怎么样?查看自己在
速度
排行榜中的位置...
走进tensorflow第十二步——
测试
cpu
和gpu的
速度
差距
好久没看这一块了,最近一直瞎折腾,各种捣鼓,到了这个阶段,迷…… 打算测一下
cpu
和gpu的实际差距,虽然我这gpu一般般,只有2G,但还是想看看能不能来点儿惊喜。
测试
代码来自如下平台: https://databricks.com/tensorflow/using-a-gpu 如果嫌麻烦可以直接copy以下代码: #!/usr/bin/env python # -*- coding...
TF2.8
CPU
及GPU
速度
测试
测试
CPU
及GPU在TF下面的
速度
差异 import tensorflow as tf import time def time_matmul(x): start = time.time() range_1 = 1000 for loop in range(range_1): tf.matmul(x, x) result = time.time()-start print("{} loops: {:0.2f}ms".format(range_1,1000*result))
Delphi
5,943
社区成员
262,941
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章