delay procedure & time of cpu (BP7) 
Author Message
 delay procedure & time of cpu (BP7)

Why following procedure takes so much of time of cpu?
Under WinNT this process occupies 100% of processor!
 How this to eliminate or to minimalize?

 Procedure Delay(ms : LongInt);
Var TickCount : LongInt;
    M         : TMsg;
Begin
 TickCount := GetTickCount;
 While GetTickCount - TickCount < ms do
 If PeekMessage(M,0,0,0,pm_Remove) then
  Begin TranslateMessage(M); DispatchMessage(M);End;
End;

empeka



Wed, 18 Jun 1902 08:00:00 GMT  
 delay procedure & time of cpu (BP7)
why dont you just use the delay() procedure supplied in the CRT unit?

Quote:
> Why following procedure takes so much of time of cpu?
> Under WinNT this process occupies 100% of processor!
>  How this to eliminate or to minimalize?

>  Procedure Delay(ms : LongInt);
> Var TickCount : LongInt;
>     M         : TMsg;
> Begin
>  TickCount := GetTickCount;
>  While GetTickCount - TickCount < ms do
>  If PeekMessage(M,0,0,0,pm_Remove) then
>   Begin TranslateMessage(M); DispatchMessage(M);End;
> End;

> empeka



Wed, 18 Jun 1902 08:00:00 GMT  
 delay procedure & time of cpu (BP7)


Wed, 18 Jun 1902 08:00:00 GMT  
 delay procedure & time of cpu (BP7)



Quote:
> why dont you just use the delay() procedure supplied in the CRT unit?

Because my programm is compiled under windows ,
not real or protected


Wed, 18 Jun 1902 08:00:00 GMT  
 delay procedure & time of cpu (BP7)


Wed, 18 Jun 1902 08:00:00 GMT  
 delay procedure & time of cpu (BP7)

Quote:
>why dont you just use the delay() procedure supplied in the CRT unit?

>> Why following procedure takes so much of time of cpu?
>> Under WinNT this process occupies 100% of processor!
>>  How this to eliminate or to minimalize?

  One reason for not using the Delay routine supplied in the
CRT unit is that it assumes it has the processor all to itself
(in addition to the famous 'Divide By Zero (#200)' bug when
CRT unit initializes the delay count on fast systems.)

  To resolve the CPU hogging for long delays, try releasing
timeslices to the operating system if >0.1 seconds to go.
Under the Windows 3.1 library, the procedure was called
'yield' and took no parameters.  The loop will need to be
modified to take into account the fact that the next CPU
timeslice the program gets might be at an unknown later
time. (especially if several other windows are also open)
  You might have to ask the OS for the time-of-day to
stabilize the loop's length which in turn can make your
computer's clock 'run slow' due to a bug within Microsoft's
code.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Delays on diff cpu

2. Delays on different cpu

3. BP7 CPU eating fix for IDE

4. 300Mhz CPU's and BP7 execution

5. BP7, Win98 and 300-400 Mhz cpu's

6. Cpu vendor identification in BP7

7. 100 % of CPU time during SQL query !!!

8. Smallest measure cpu time spent unit in pascal

9. CPU-time

10. How to use DELAY in OWL? BP7

11. Fast PutCharacter Procedure &/or remove cursor procedure

12. Implementing efficient time delays

 

 
Powered by phpBB® Forum Software