Rumor has it that Alan G may have mentioned these words: > > I'm running an application that has a polling loop to check a serial >port > > for certain signals, and on my laptop I can get about 6700 samples >per > > second, which (of course) consumes 100% CPU; which may impact >battery life. > >Consuming 100% CPU won't make much difference, the CPU is running all >the time anyway (when its not asleep).
Not mine... my laptop runs a Crusoe processor, and it can automatically scale itself from 300Mhz to 933Mhz. It's called "LongRun" technology, and it works quite well, too. On my extended battery at "near idle" ... say, playing Spider, I get 5+ hours of battery life (and the battery's 2 years old, just like the laptop). Running the program at full tilt, I get just over 2 hours (but admittedly, it's scanning my USB->RS232 dongle, and I don't know how much current that may take... However, it's not transmitting, so it shouldn't be an overly huge amount.) I can run more tests if anyone's interested, but... Since the first Pentium (and possibly '486s) the CPU could put itself in a wait state to conserve CPU cycles that weren't being used -- and "wake itself up" automatically when needed. WinNT 4.0 and newer (and most *nixen) could use that, altho it didn't make *as much* difference for thermal or power aspects back then; the ability was there mainly for multiprocessor applications. Now they've improved it for both thermal and power usage functions as well. > What will consume batteries much >faster is if you are accessing hardware such as disk or modem or other >power hungry devices. I would only get about 1.5 hours (when the battery was new) compiling my LinuxFromScratch -- 100% CPU, HD getting hammered and snagging packages off of the CDROM... yea, the battery (and external charger) got quite a workout those few weeks... ;-) >I've never tried in Python but can you use select()? >I've used it in C for short duration intervals. Never used it yet (altho I saw references that Python's time.sleep() actually *uses* select instead of usleep/nanosleep. Not being a C hacker, I don't know much about it, but I'll check it out. Thanks! =-=-= I was also looking into trying the usleep implementation in wxPython -- well, I couldn't get the rascal compiled on my old Linux From Scratch version 4 installation (my main working Linux for that laptop) no matter what I turned off in .configure... I guess I should prioritize my LFS6 install a bit higher. ;-) Thanks one and all, and back to "quiet mode" I go... ;-) Roger "Merch" Merchberger -- Roger "Merch" Merchberger | "Profile, don't speculate." SysAdmin, Iceberg Computers | Daniel J. Bernstein [EMAIL PROTECTED] | _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor