Power Measurement Problem: Question

Ian Smith smithi at nimnet.asn.au
Tue Mar 11 17:01:17 UTC 2008


On Tue, 11 Mar 2008, [utf-8] Cihan Kömeçoğlu wrote:
 > I would like to measure the fine-grained consumed power
 > per wireless transaction on a loptop. I am sure that
 > the most fine-grained measurement would be physically wiring the
 > laptop battery with a voltmeter. However, this is inconvenient for me.

Measuring battery voltage tells you virtually nothing about present
power consumption, except as something to multiply measured current by,
yielding power in watts.  That is, an ammeter would be more useful.

 > Thus, I installed acpi in order to measure the power consumed by the
 > wireless interface of my laptop. However, my understanding is that
 > acpi periodically flushes the power measurements into a state file.

I don't think so, but if so, what file?  Maybe that's a linux thing?

 > Is it possible to tell the acpi to flush its power state into the
 > state file whenever a wireless transaction is performed. If not,
 > is there a tool that can be used to get the power state of the
 > battery?

% acpiconf -i 0

shows available data for battery #0, etc, including 'Present rate',
shown in milliWatts on my machine, using CMBAT method.  Check out
/usr/src/usr.sbin/acpi/acpiconf/acpiconf.c and
/usr/src/sys/dev/acpica/{acpiio.h,acpi_cmbat.c}

However, there are limitations that make problematic repeatedly reading
these data via acpiconf (or using lower level code such as acpi_cmbat.c
more directly) that likely depend on type, brand and model of battery to
some extent, including:

a) The battery info is only updated, apparently by the battery device
itself, about (here) once every 10 seconds.  ie, running 'acpiconf -i 0'
repeatedly only shows updated values about that often.

b) The 'Present rate' returned appears to be averaged over a much longer
period than that update interval.  ie, increasing power usage from idle
to full speed (faster cpu freq) which in my case approximately doubles
total consumed power, only slowly ramps up, and then only slowly ramps
down again after returning to idle, taking almost a minute here.

c) Worse, 'Present rate' only shows average power consumed while running
on battery.  While charging, it shows the rate at which the battery is
being charged, which tapers off approaching full charge (again, I can
only say what happens on my Thinkpad T23).  This rate appears not to
significantly vary by processor loading etc, as it does on battery. 

Testing while running on battery, you could use the method employed by
powerd.c in foreground (-v) mode, assuming your ACPI provides milliWatts
along with cpu freqs, to subtract cpu power from total power out of the
battery to calculate what, eg, your wireless card is using.  Tricky ..

Hopefully somebody can point out a much more direct method, but in fact
employing an inline ammeter on the battery to determine (average) power
actually used by your wireless card empirically might be your best bet,
given that this will vary significantly between receive and transmit.

cheers, Ian



More information about the freebsd-acpi mailing list