Re: Is delphi a good introduction to programming?



"Paul Dunn" <paul.dunn4@xxxxxxxxxxxx> wrote in message
news:Xh_fe.468$Nt.153@xxxxxxxxxxxxxxxxxxxxxxx
[...]
> The biggest problem I encountered (and have yet to find a solution for)
> is that when running the emulation in the idle loop, everything runs
> smoothly until some other application takes any CPU time, at which point
> my app stalls and stutters. My app consumes about 1-2% CPU time, and if
> another app takes any more than 4% CPU then my app is stalled. I can't
> figure that out at all. My loop consists of emulating a frame (20ms, or
> 69888 cycles) of Z80 code, then sleeps in 1ms intervals until the full
> real 20ms has elapsed. This typically results in 18-19ms of sleep time
> per frame, but I still get the stuttering.
>
> I think it's a fault of application.run; but I have no idea how to get
> around it :(

Isn't 20 ms close to Windows' own timeslice? Perhaps quantisation is
behind this.

You can either be nice and surrender your timeslice when you're not
using it, but then you're at Windows' mercy with regard to when it
comes back to you, or you can be accurate and spin - but spinning 90%
of the time or more might bother me, too.

Did you try other frame lengths? And Sleep(0) instead of Sleep(1)?

Groetjes,
Maarten Wiltink


.



Relevant Pages

  • Re: Is delphi a good introduction to programming?
    ... >that when running the emulation in the idle loop, ... My app consumes about 1-2% CPU time, ... using the high-priority class, because a high-priority class ...
    (comp.lang.pascal.delphi.misc)
  • Re: processor time allocation
    ... Do you happen to update UI in OnIdle function? ... >> If the CPU load is not 100%, your app gets all CPU time it can use. ... >> app is not able to use all the CPU power, fix it. ...
    (microsoft.public.vc.mfc)
  • Re: A correct "mojave" experiment for Vista
    ... I was talking about a typical system running on older hardware then adding a service or app that takes a lot of CPU time. ... The OS is irrelevant in that when you split up the time each task gets, the tasks run slower. ...
    (microsoft.public.windows.vista.general)
  • Re: Parallels, M$ Virtual PC & VMWare - Re: For pmj
    ... but I will blame it on the lack of logic in Windows. ... When the script starts I got a pop up saying do you want to run this ActiveX control, I click Yes and off it goes. ... seconds, CPU time 30%-50%. ... I'll have a play with the C# app, I've probably misinterpreted something, it would make a good basis for a multi threaded test app. ...
    (uk.people.silversurfers)
  • Re: HP should stop making Calculators...!
    ... There's an exact  HP41CX/V emulation in the Apps section of the iTunes ... Many, many application cartridges are available, along with keyboard ... While that app, and many other emulators, is very nice, there's just ... same for its emulated version (e.g. m48 or m48+) ...
    (comp.sys.hp48)