如何取到CPU的频率 请指教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个问题怎么没有人答?我来吧:function GetCPUSpeed: Double; constDelayTime = 500;varTimerHi, TimerLo: DWORD;PriorityClass, Priority: Integer;begintryPriorityClass := GetPriorityClass(GetCurrentProcess);Priority := GetThreadPriority(GetCurrentThread);SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);SetThreadPriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);Sleep(10);asmdw 310Fh // rdtscmov TimerLo, eaxmov TimerHi, edxend;Sleep(DelayTime);asmdw 310Fh // rdtscsub eax, TimerLosbb edx, TimerHimov TimerLo, eaxmov TimerHi, edxend;SetThreadPriority(GetCurrentThread, Priority);SetPriorityClass(GetCurrentProcess, PriorityClass);Result := TimerLo / (1000.0 * DelayTime);exceptResult := 0;end;end;*************在VC中用以下代码可以测出CPU的主频:static int time[2]int cpuclock;在InitInstance中SetTimer(hWnd,1,1000,NULL)在消息处理过程中case WM_CREATE;_asm{rdtsc //一个64bit的时间标记计数器mov ecx,offset timemov [ecx+0],edxmov [ecx+4],eax}break;case WM_TIMER:_asm{rdtscmov ebx,offset timesub eax,[ebx+4]sbb edx,[ebx+0]mov ecx,1000000div ecxmov cpuclock,eax}但不知在DELPHI中如何编程测试?还有CPU的类型等等! --------------------------------------------------------------------------------来自:cat.yy 时间:00-12-29 16:17:03 ID:427844SetTimer(handle,1,1000,NULL);......(var msg: message)...if msg.message=WM_CREATE thenbeginasmrdtsc //一个64bit的时间标记计数器mov ecx,offset timemov [ecx+0],edxmov [ecx+4],eaxend;end;if msg.message=WM_TIMER thenbeginasmrdtscmov ebx,offset timesub eax,[ebx+4]sbb edx,[ebx+0]mov ecx,1000000div ecxmov cpuclock,eaxend;end;*************function TForm1.GetCpuSpeed: Extended;vart, mhi, mlo, nhi, nlo: dword;shr32 : comp;beginshr32 := 65536;shr32 := shr32 * 65536;t := GetTickCount;while t = GetTickCount do ;asmDB 0FH,031H // rdtscmov mhi,edxmov mlo,eaxend;while GetTickCount < (t + 1000) do ;asmDB 0FH,031H // rdtscmov nhi,edxmov nlo,eaxend;Result := ((nhi * shr32 + nlo) - (mhi * shr32 + mlo)) / 1E6;end; Delphi7无法访问无法访问VS2008做的WebService服务端,而Delphi2010可以!为什么? !!!超难问题:如何让多个客户端的数据保持同步刷新? 大侠帮忙 困扰很久了! kao delphi里取启动参数是哪个啊!?? 关于格式化字符串的问题?(如:142,463,635.98元) 特别的问题盼望回应 请教关于SQL查询的语句 如何将 Hook 的消息去除? cxGrid 在indicator 显示图标的问题? 不显示窗体,copy窗体保存为TBitmap,并保存图片,谁有招 如何向数据库中添加内容?
function GetCPUSpeed: Double;
constDelayTime = 500;varTimerHi, TimerLo: DWORD;PriorityClass, Priority: Integer;begintryPriorityClass := GetPriorityClass(GetCurrentProcess);Priority := GetThreadPriority(GetCurrentThread);SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);SetThreadPriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);Sleep(10);asmdw 310Fh // rdtscmov TimerLo, eaxmov TimerHi, edxend;Sleep(DelayTime);asmdw 310Fh // rdtscsub eax, TimerLosbb edx, TimerHimov TimerLo, eaxmov TimerHi, edxend;SetThreadPriority(GetCurrentThread, Priority);SetPriorityClass(GetCurrentProcess, PriorityClass);Result := TimerLo / (1000.0 * DelayTime);exceptResult := 0;end;end;*************在VC中用以下代码可以测出CPU的主频:static int time[2]int cpuclock;在InitInstance中SetTimer(hWnd,1,1000,NULL)在消息处理过程中case WM_CREATE;_asm{rdtsc //一个64bit的时间标记计数器mov ecx,offset timemov [ecx+0],edxmov [ecx+4],eax}break;case WM_TIMER:_asm{rdtscmov ebx,offset timesub eax,[ebx+4]sbb edx,[ebx+0]mov ecx,1000000div ecxmov cpuclock,eax}但不知在DELPHI中如何编程测试?还有CPU的类型等等! --------------------------------------------------------------------------------来自:cat.yy 时间:00-12-29 16:17:03 ID:427844SetTimer(handle,1,1000,NULL);......(var msg: message)...if msg.message=WM_CREATE thenbeginasmrdtsc //一个64bit的时间标记计数器mov ecx,offset timemov [ecx+0],edxmov [ecx+4],eaxend;end;if msg.message=WM_TIMER thenbeginasmrdtscmov ebx,offset timesub eax,[ebx+4]sbb edx,[ebx+0]mov ecx,1000000div ecxmov cpuclock,eaxend;end;*************function TForm1.GetCpuSpeed: Extended;vart, mhi, mlo, nhi, nlo: dword;shr32 : comp;beginshr32 := 65536;shr32 := shr32 * 65536;t := GetTickCount;while t = GetTickCount do ;asmDB 0FH,031H // rdtscmov mhi,edxmov mlo,eaxend;while GetTickCount < (t + 1000) do ;asmDB 0FH,031H // rdtscmov nhi,edxmov nlo,eaxend;Result := ((nhi * shr32 + nlo) - (mhi * shr32 + mlo)) / 1E6;end;