[ltp] Running without a battery?

Jim Brewster linux-thinkpad@linux-thinkpad.org
Wed, 14 Jan 2004 14:05:09 -0500


On Wednesday 14 January 2004 09:53 am, Behdad Esfahbod wrote:
> On Wed, 14 Jan 2004, mukesh agrawal wrote:
> > On Wed, 14 Jan 2004, Dr. Jason Breitweg wrote:
> > > Yeah, that would be really cool if you could check that out. 
> > > How does one tell if the CPU is running at a lower speed?
> >
> > Any program that just executes a CPU loop would work. bogomips is
> > one such program, that might already be installed.
> >
> > If not, something like the following should do the trick:
> >
> > --- spin.c ---
> >
> > main() {
> > 	int i = 1E6;
> >
> > 	while (i) --i;
> > }
> >
> > --------------
> >
> > % gcc spin.c -o spin
> > % time spin
> >
> > Just compare how long it takes to execute (plugged in vs
> > unplugged, or whatever scenarios you want).
> >
> > You might need to adjust the value of i up or down, depending on
> > how long it takes to execute. (If it returns in less than 1
> > second in both cases, make i bigger.)
>
> Not a single loop works still ;).  On my P4 2.4, 1E9 takes 0.7s
> and 1E10 apparently overflows 32bit int.

Try 9E9
-- 
Jim Brewster
bardobro@toad.net
http://www.jimbrewster.net/

"You have to be out of your mind to come to your senses."
--Fritz Perls