battery charging and discharging graphs

Harald Koenig koenig at
Tue Aug 26 18:50:31 CEST 2008

On Aug 22, Jozef Mlich wrote:

> i have made a couple graphs of battery charging and discharging. 

I hate those "me too"-mails -- but here I go: me too ;-)

> So in case you are interested a have published my results on my blog:
> . There
> are a few words in Czech which you can just skip. The graphs was made on
> fso-testing image from 20. August 2008 with disabled "Suspend" and with
> turned on gps and wifi. On the blog are also links to script which generates
> graphs.

very interesting!  I started to collect battery data too, to get an idea
what's alreay possible (and what might be possible).  

here is a PDF with 3 (gnu;)plots (data etc. available on request):

plot 1: 3 charge/decharge runs with no suspend (two with 500 mA from notebook
and one with 1000 mA AC charger).  
decharging is with different display brightnesses (low/high/off).

plot 2 and 3 show decharging while being suspended (or trying to be so;),
sorry for different X scaling...

for plot 2+3  I use a "atd" script which collects data, triggers the next job
in "now + 10 minutes"  and suspends the OM again (see below).

what worries me in plot 2+3 right now is the fact that suddenly during night
the decharging rate significantly increases (see 24h and and 55h
in plot 2, 5400 min and ~5800 min in plot 3!).

the extrapolation for the 1st decharge in plot 2 shows an estimated
"uptime" (being mostly suspended though;) of ~50+ hours with a 
wakeup every 10 minutes -- wouldn't be that bad, but it's only
an extrapolation and I never managed to get any close to that "uptime"
so far as the plots show:-(

the OM alyways was "as idle as possible" (running Om 2008.8 with zecke-dev updates).

at least one time there seemed to be problems with suspend, I got
lots of "apm: can't suspend -- device or resource busy" (or similar) 
messages in logread or dmesg output.

but for the last decharge in plot 3 (5600-6150 min) I just picked up the OM
at 1 % before crashing and here "apm -s" still worked fine, so there has to 
be another reason for that increase in power usage during night.

more details about that last run which I just noted while collecting
data for another problem (see devel-list subject: Xglamo loops and hangs...):

that last run (5600-6150) startet ~23:00 (== ~5550), the bend at 80% 
is around 03:30 in the moring (0% is 08:58).  

now I noticed in "ps" output, that Xglamo got restarted at 06:40 
for yet unknown reason.  _maybe_ the reason for that Xglamo crash/restart 
and the power usage have some common reason ? __maybe__ there was
a 1st Xglamo crash before at 03:30 when "something" happend which
increased power usage ?!?

just a thought, but no good idea how to further check/log such things.

any comments/ideas/suggestions ?

/var/spool/at/script-1 :


cd /var/spool/at
( date ; apm) >> /tmp/date.out
ln -s script-1 ` /home/root/now_plus 600 `.1
rm $0

echo `date +%s ; date ; cat /sys/devices/platform/bq27000-battery.0/power_supply/bat/capacity /sys/devices/platform/bq27000-battery.0/power_supply/bat/time_to_full_now /sys/devices/platform/bq27000-battery.0/power_supply/bat/voltage_now /sys/devices/platform/bq27000-battery.0/power_supply/bat/current_now `  >> /home/root/bat11.dat

echo >> trigger
sleep 1

# for interactive use, better comment out this "apm -s" and use the 
# power management of illume....
apm -s

to start the data collection once use

   cd /var/spool/at
   ln -s script-1 1.1
   echo >> trigger

due to problems with shell arithmetic for time data in seconds ("dc" outputs 
float values in exponential representation, "bash" crashes at startup when 
used in "atd" scripts:-(   I use the following small C program to 
get the "next timestamp" for atd:

/* now_plus.c */
#include <stdio.h>
#include <sys/time.h>

main(int argc, char *argv[])
  struct timeval tv;
  int i=0;
  if (argc>1)
    i = atoi(argv[1]);


"I hope to die                                      ___       _____
before I *have* to use Microsoft Word.",           0--,|    /OOOOOOO\
Donald E. Knuth, 02-Oct-2001 in Tuebingen.        <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig                                           //  /     \\  \
koenig at                     ^^^^^       ^^^^^

More information about the hardware mailing list