Hogging the processor

Blitz3D Forums/Blitz3D Programming/Hogging the processor

IPete2(Posted 2004) [#1]
Hi Team!

I know I have read this before about B3d grabbing every cpu cycle it can, is there a way to have a B3D application running in a window and yet leave enough cpu cycles for another application to run alongside?

Thanks,

IPete2.


GfK(Posted 2004) [#2]
Use the 'Delay' command, so I'm told...


IPete2(Posted 2004) [#3]
Hi,

Thanks for the speedy response.

Just use delay in the main loop then?

Okay I'll give it a whirl -

Thank you.

IPete2.


Picklesworth(Posted 2004) [#4]
I think there's a DLL you can get that says how much cpu power is being used outside of blitz, so you could use that with the delay command to make it even nicer.


slenkar(Posted 2004) [#5]
"mini me!, stop hogging the processor!"


IPete2(Posted 2004) [#6]
Thanks guys,

I need to do some experiments I think - although a delay of 3 seems to solve the problem I was having.

IPete2.


jfk EO-11110(Posted 2004) [#7]
Use an Idle Check in your Program. If there has been no User Input (check 0 to 255 keydown, mouse etc) then repeat eg. a delay 3 or so until the user does something. Most times it's only the mouse position anyway that will be used to exit from the idle mode.


IPete2(Posted 2004) [#8]
Nice thinking JFK, thanks.

IPete2.


Zethrax(Posted 2004) [#9]
What I do is to have a 'do_update' global variable to control whether rendering, etc, occurs. This is set to true if control input is detected or if some other event occurs that requires time intensive procedures, such as rendering, to be updated. If it is set to false ( the default value, per loop) then a Delay( 20 ) is executed instead.

Using this method, the idle time CPU usage shows up as 0% in the Task Manager. The model viewer program in my sig uses this method.