[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: Battery Life



The method I mentioned above should be more power efficient for X11.

It just waits on the X11 socket for activity.

Also it might be worth only initialising the modules you use.

eg.  Instead of pygame.init() just do pygame.display.init() .



On Jun 4, 12:24 am, "Doug Petkanics" <petkan...@xxxxxxxxx> wrote:
> >What does strace show your process doing?
>
> While the process is idling it shows repeated:
> select(0,NULL, NULL, NULL, {0, 10000}) = 0 (Timeout)
> select(5, [4], NULL, NULL, {0, 0})           = 0 (Timeout)
> select(0,NULL, NULL, NULL, {0, 10000}) = 0 (Timeout)
> select(5, [4], NULL, NULL, {0, 0})           = 0 (Timeout)
> select(0,NULL, NULL, NULL, {0, 10000}) = 0 (Timeout)
> select(5, [4], NULL, NULL, {0, 0})           = 0 (Timeout)
>
> ...and so on
>
> I assume this polling is the underlying pygame implementation of
> pygame.event.wait(). Wonder if there's any more efficient way?
>
> Thanks,
> Doug
>
> On Tue, Jun 3, 2008 at 7:18 AM, Marius Gedminas <mged...@xxxxxxxx> wrote:
> > On Mon, Jun 02, 2008 at 09:31:34PM -0700, The dob wrote:
> > > I'm running pygame on Maemo (linux on a mobile device). In my main
> > > game loop I am using pygame.event.wait() and sleeping all other
> > > running threads. To me this means that until there is an event, the
> > > process should not consume very much processor time. Unfortunately,
> > > the battery on the device still drains very quickly (about 4 hours
> > > when idle, as compared to 2 days while other applications are idle).
>
> > > Running 'top' does not indicate that the idle process is consuming
> > > very much processing power either.
>
> > What does strace show your process doing?
>
> > Marius Gedminas
> > --
> > It's not illegal to disagree with my opinions (*).
> > [...]
> > (*) Although it obviously _should_ be. Mwhaahahahahaaa... You unbelievers
> > will all be shot when the revolution comes!
> >                -- Linus Torvalds
>
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.6 (GNU/Linux)
>
> > iD8DBQFIRShrkVdEXeem148RAlEFAJ0dYriqVXkQad+APqg0Y6gQ+GE+JACeME45
> > zf5arVQY34yAVBAGRC8W2As=
> > =gx5F
> > -----END PGP SIGNATURE-----