الحالة
مغلق و غير مفتوح للمزيد من الردود.

aaqassam

New member


السلام عليكم ورحمة الله وبركاته
كود يقوم بأظهار لك سرعة المعالج .. . ~




كود:
function getcpuspeed: 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;


مثال للاستخدام يمكننا أن نضعها في الزر ..~

كود:
begin
labelcpuspeed.caption := format('cpu speed: %f mhz', [getcpuspeed]);
end;




 

التعديل الأخير بواسطة المشرف:

المواضيع المشابهة

الحالة
مغلق و غير مفتوح للمزيد من الردود.
عودة
أعلى