LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Calculate power usage real time (https://www.linuxquestions.org/questions/linux-software-2/calculate-power-usage-real-time-932836/)

turkejd 03-05-2012 10:12 AM

Calculate power usage real time
 
Hi,

I am willing to calculate the power usage of my laptop during, for example, 5 minutes (short lapse of time).
Then I change something in my system (like I turn off network interfaces, etc)
and redo this calculation, in order to see the differences.

So far I found out gnome-power-statistics and powertop which both do not what I want.

Is there a software that show the amount of energy used in a certain interval of time?

Thanks.

michaelk 03-05-2012 12:58 PM

I do not know what other applications are out there but it would be easy to create a script to calculate whatever you want. The values are located in the file /proc/acpi/battery/BAT0/state (BAT0 directory name depends on distribution). The value you are looking for is present state (current) and present voltage.

Power watts = (present state X Present voltage)/1000

turkejd 03-05-2012 01:32 PM

Quote:

Originally Posted by michaelk (Post 4619104)
I do not know what other applications are out there but it would be easy to create a script to calculate whatever you want. The values are located in the file /proc/acpi/battery/BAT0/state (BAT0 directory name depends on distribution). The value you are looking for is present state (current) and present voltage.

Power watts = (present state X Present voltage)/1000

That is wonderful. It is the simplest solution!

However there is a little problem. I get an 'unknown' value on present voltage.
Is it meaningful to use only the present state as an indicator?

Thanks

michaelk 03-05-2012 01:48 PM

Yes since any changes you make to the system will be shown in the amount of current draw.

jefro 03-05-2012 03:33 PM

You'd be better off with a kill-a-watt meter. The one I have has a time monitor. I can monitor for a few minutes to years.

Any OS based will not be very accurate.

turkejd 03-05-2012 04:51 PM

Quote:

Originally Posted by jefro (Post 4619226)
You'd be better off with a kill-a-watt meter. The one I have has a time monitor. I can monitor for a few minutes to years.

Any OS based will not be very accurate.

Thank you, but I don't need something too accurate for what I want to do.
As long as I can get a significant difference of power usage when I, for example, turn off a network interface, or something like that.

I am taking your advice for future needs though.

turkejd 03-06-2012 03:51 AM

Since you've been so helpful I want to ask you this other question.

I noticed that there is no decrease in the present rate when I switch off a network interface.

A little background:
I am using an experimental protocol (MPTCP) to use all network interfaces simultaneously in a TCP connection.
If I download a file with both interfaces on (eth0 and wlan0), every interface receive at 400 KB/s. The total bandwidth achieved is about 800 KB/s.

If I switch off, let's say, wlan0, I get all traffic on eth0 (800 KB/s).
The problem is that there is no decrease in the power consumption.

Is that because the interface that stays on receive double the traffic than before? Or is it because, as jefro said, this OS based method is not accurate?
How is this possible that there is no decrease in power usage?

Thanks


All times are GMT -5. The time now is 11:12 AM.