[OLPC-Games] Reducing pygame cpu-load to < 4 %

Chris Hager chris at linuxuser.at
Tue Dec 11 15:12:13 EST 2007


C. Scott Ananian wrote:
> I have patched Pippy's examples to follow best practices for pygame,
> so that the frame rate is limited to 20 FPS and games automatically
> pause and suspend after 20 seconds of inactivity.  (These defaults can
> be overridden.)
>
> The patch is pullable from:
> http://dev.laptop.org/git?p=users/cscott/pippy-activity-tmp;a=commitdiff;h=9df72c5591aee015089a4e96f9403183262dcc01
>  --scott
>
>   
The suspend-function (from game.py) wouldn't work here in the emu, 
because only root hast write-access to /sys/power/state. Is this 
possible on the xo, and are there other ways to suspend as well?

# SUSPEND
try:
    open('/sys/power/state','w').write('mem')
except:
    # XXX: couldn't suspend (no permissions?)


Btw, for monitoring the load of the imagequiz, i've written a little 
script to capture a single process and it's system load. It's 
plugin-based and outputs as text in the console and/or as graph with gtk:

[1] 
http://www.olpcaustria.org/mediawiki/index.php/Process_monitoring_with_pw.py

- Chris




More information about the Games mailing list