CPU runs to 100%
BlitzPlus Forums/BlitzPlus Programming/CPU runs to 100%
| ||
Hello, when I run my programm, my CPU ist 100% charged to capacity. What can I do? Is this normal?? J.P.D |
| ||
what is your program doing to consume so much processor time? Wow Skully |
| ||
Same problem here. I've made a simple pong game and my cpu takes the full 100%. Are those if...endif or while...wend loops so cpu-intensive? |
| ||
It's a known issue .., view an image with acdsee while a B+ app is running? Have fun .. you need to alt-tab back to your app again to help acdsee viewing that image :P It's said however that putting: DELAY 2 into your mainloop solves a bit.. |
| ||
Are you using WaitEvent(0) or WaitEvent() in your main loop? (WaitEvent(0) takes much more CPU time) |
| ||
Indeed, it consumes about 20% less. With delay set to 4 it saves about 25%. And a delay set to 10 consumes less than half (on my computer) |
| ||
@fabian: I do not use waitevent in my pong-program |
| ||
Try doing delay(#ofmillisecs). Alternatively if you want your app to always run at 30 frames per second, so it is the same speed on every computer, you can do: timer=createtimer(30) and then use waittimer(timer) to wait for 1/30th of a second to go by before you draw the next frame. This should keep your CPU usage down to normal levels. |
| ||
That's silly. The WaitEvent command is not listed in the command reference list in B+. |
| ||
ofcourse it is.. >GUI Category >> Events >>> WaitEvent Using events rather than polling is a better way to go anyway.. |
| ||
I thought in the category 2d a-z I could find it. There's a lot to learn I see. |
| ||
In B+ events/gadgets are related to 'GUI' Polling and drawing/sound/files etc. are related to '2d' |