[an error occurred while processing this directive]
|
То что под DOS работает быстрее, понятно под windows, время делится
на на все задачи.
Вот пример работы с "перетягиванием одеяла" на себя.
То есть задача ставит себе приоритет RealTime.
Function GetCPUSpeed: Double;
const
DelayTime = 500;
var
TimerHi : DWORD;
TimerLo : DWORD;
PriorityClass: Integer;
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;
А в DOS нужно попробовать ассемблерные вставки.
E-mail: info@telesys.ru