Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat Oct 23, 2010 5:39 am   

[3.31] #Update, windows 7, cpu usage.
 
I have an alarm that uses #update on a single button every 0.1 second. Obviously, this is very fast, but I use it to update a button which displays the time left on an alarm, so precision is important. The issue is, this single alarm updating this single button is causing cmud to spike to 20% cpu usage while everything else is idle. This only became an issue after updating to windows 7, so while I realize it's likely a OS issue, I'm hoping it's fixable on cmud's side.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Oct 23, 2010 3:39 pm   
 
What kind of variable? If it's a simple integer, then #UPDATE isn't even needed (and probably is causing your button refreshing to double up, hence the %20 spike).

If it's a datarecord, then your button is being refreshed every time any key in the variable is being changed--regardless of whether the button uses those keys or not.

Also, isn't the interval for alarms still kept to a minimum of .501 seconds?
_________________
EDIT: I didn't like my old signature
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat Oct 23, 2010 11:09 pm   
 
There isn't a variable, it's just a display of %alarm( alarm_id ). Thus it doesn't auto-update.

Alarms definitely work at below .5 seconds.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Oct 25, 2010 5:11 pm   
 
That is a bad idea. The #UPDATE command causes Windows to repaint/refresh the screen. This will use a lot of CPU and cause a lot of lag, especially because Win7 and Vista have slower screen update routines (because of the "Window Composition" features, which you might try turning off unless you are in love with the Win7 fancy graphics).

There isn't any minimum for alarm times, so you are correct on that. Not sure what other solution to suggest. If you really need that sort of update precision then it's just going to take a lot of processing time.

You might try changing your 0.1 second alarm to just update a regular variable, like:

alarmVar = %alarm(alarm_id)

and then put @alarmVar into the button capture to allow CMUD to do auto updating and see if it makes any difference.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Mon Oct 25, 2010 5:30 pm   
 
Nope, afraid the variable solution by itself didn't help with the cpu usage. Though, what it does allow me to do is keep the alarm at the same time, but truncate the decimal places, which means it'll only auto-update every second, and still be accurate.

Thanks!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Oct 25, 2010 5:49 pm   
 
Yeah, since the CMUD auto-update was going to take the same time as the manual update, I didn't really expect it to change your CPU usage. But glad it helps make things more flexible.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net