?? 356.htm
字號:
<!-- saved from url=(0022)http://internet.e-mail -->
<html>
<head>
<title>如何測試CPU的速度 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="inc.css">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="195434" alink="195434">
<table width="621" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="621"><a href="http://www.CoDelphi.com"><img src="images/logo.gif" border="0" width="153" height="60"><img src="images/bigbanner.gif" border="0" width="468" height="60"></a></td>
</tr>
</table><br>
<br>
<table width="621" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" valign="top" class="font9" height="155">
<div align="center" class="btitle">如何測試CPU的速度 <br>
<br>
</div>
<div align="center"><strong>Carlos Alberto Longen </strong></div>
<b><br>
摘 要</b>:這段代碼可以返回CPU的速度 <br>
<b> 關鍵字</b>:cpu 速度 頻率 <br>
<b> 類 別</b>:系統控制
<hr size="1" width="100%">
<span class="content">function CPUSpeed: Double; <Br>const <Br> DelayTime = 500; // 時間單位是毫秒 <Br>var <Br> TimerHi, TimerLo: DWORD; <Br> PriorityClass, Priority: Integer; <Br>begin <Br> PriorityClass := GetPriorityClass(GetCurrentProcess); <Br> Priority := GetThreadPriority(GetCurrentThread); <Br> SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS); <Br> SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL); <Br><Br> Sleep(10); <Br><Br> asm <Br> dw 310Fh // rdtsc <Br> mov TimerLo, eax <Br> mov TimerHi, edx <Br> end; <Br><Br> Sleep(DelayTime); <Br><Br> asm <Br> dw 310Fh // rdtsc <Br> sub eax, TimerLo <Br> sbb edx, TimerHi <Br> mov TimerLo, eax <Br> mov TimerHi, edx <Br> end; <Br><Br> SetThreadPriority(GetCurrentThread, Priority); <Br> SetPriorityClass(GetCurrentProcess, PriorityClass); <Br><Br> Result := TimerLo / (1000.0 * DelayTime); <Br>end;<Br><Br></span>
<table border="0" cellspacing="0" cellpadding="1" class="font9" align="center" width="100%">
<tr align="left" valign="middle" bgcolor="195434">
<td height="1"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#C9C9C6" height="2"></td>
</tr>
</table>
<div align="center"><br>
中文開發在線<a href="http://www.codelphi.com" target="_blank">www.codelphi.com</a>授權使用。
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -