You are not logged in.

#1 2011-10-20 23:55:19

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

How to check power consumption with /sys/class/...

Hello everyone,
I've read that /proc/acpi/battery/BAT0 became deprecated, and has been replaced by /sys/class/power_suply/BAT0... That's ok for me, but since I am using and ION 2 (Optimus) based laptop, I want to see the consumption in mA like when I did this : "grep rate /proc/acpi/battery/BAT0/state". I have tried with "acpi -V" etc.. but I didn't find a good one who gives the same information.

Can anyone help me with this ?

Thanks in Advance,
Luis Da Costa

Offline

#2 2011-10-21 10:54:36

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: How to check power consumption with /sys/class/...

you should have a voltage_now and current_now file.

do the math

Offline

#3 2011-10-21 14:43:12

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

Re: How to check power consumption with /sys/class/...

Is current_now also volts ?

Offline

#4 2011-10-22 14:20:07

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Re: How to check power consumption with /sys/class/...

Hi

I use an awful script to check my laptop's power consumption. It use upower as backend. If it can help...

#!/bin/bash

CONSO=0

while :
    do
    sleep 1
WATT=`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk '/energy-rate:/{print $2}' | cut -f1 -dW`
TEMPO=$(($TEMPO+1))
CONSO=`echo "scale=2;$WATT+$CONSO" | bc`

case $TEMPO in

10|20|30|40|50) 
C=`echo "scale=2;$CONSO/$TEMPO" | bc `
AFF="Power consumption for $TEMPO s :$C W"
;;

60)
C=`echo "scale=2;$CONSO/$TEMPO" | bc `
AFF="Power consumption by min :$C W/min"
CONSO=$C ; TEMPO=0 
;;
esac

clear ; echo -n "Wait 10 seconds

$AFF"
done

Offline

Board footer

Powered by FluxBB