Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Freeing up CPU time with dbWait

Author
Message
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 5th Mar 2011 00:03
I was wondering if anyone knows how to go about this?

I spotted somewhere in the forums that the dbWait command now doesn't hog the CPU so I updated to the 2010 GDK. I have a demo running on the screen with a dialog window open to alter setting. Within the main GDK loop it just calls the run routine for the demo. If the pause is active then I have got it to do nothing except dbWait(60). There's hardly any noticeable change in CPU speed. The only other thing running on the program at that point is just the windows messaging system for the dialog.

Have I got the wrong update? Or is there another update further than that?

Warning! May contain Nuts!
Superdeath360
13
Years of Service
User Offline
Joined: 23rd Nov 2010
Location:
Posted: 7th Mar 2011 00:43 Edited at: 7th Mar 2011 00:43
Idk if it has anything to do with this, but using dbWait(1); at the end of each loop makes my client lag less when using multisync.

edit: ya it has nothing to do with this

herp derp
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 7th Mar 2011 01:28
The basic DarkGDK dbWait(time) doesn't free up CPU cycles like IanM's "nice wait" in his Matrix1Utils plugin for DBPro.


Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 7th Mar 2011 13:58
Just use the Sleep windows command.

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 7th Mar 2011 16:19
After a bit of googling I got the sleep() command to work. My program kept freezing unless the mouse was moving and I found that I had to use PeekMessage instead of GetMessage.

Thankyou. Processor usage has now gone from 55% right down to between 0% and 2% when paused. Perfect.

Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-11-19 12:39:21
Your offset time is: 2024-11-19 12:39:21