diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-04-28 22:34:54 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-04-28 22:34:54 -0400 |
commit | 0f4c63763f2151b25b17b688fed762fd09ae1530 (patch) | |
tree | 68d26d958a03af2587090eceec2a6b2ae7841b19 /pts-core/functions/pts-functions_system.php | |
parent | 09b5cc5c44b6b57c8e38b6f5a8197e1923282292 (diff) | |
download | phoronix-test-suite-upstream-0f4c63763f2151b25b17b688fed762fd09ae1530.tar.gz phoronix-test-suite-upstream-0f4c63763f2151b25b17b688fed762fd09ae1530.tar.xz phoronix-test-suite-upstream-0f4c63763f2151b25b17b688fed762fd09ae1530.zip |
Add battery.power option to MONITOR= and a few other fixes in this
commit too
Diffstat (limited to 'pts-core/functions/pts-functions_system.php')
-rw-r--r-- | pts-core/functions/pts-functions_system.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pts-core/functions/pts-functions_system.php b/pts-core/functions/pts-functions_system.php index 49fa2bb..7a4d463 100644 --- a/pts-core/functions/pts-functions_system.php +++ b/pts-core/functions/pts-functions_system.php @@ -247,6 +247,18 @@ function pts_record_sys_temperature() if($temp != -1) array_push($SYS_TEMPERATURE, $temp); } +function pts_record_battery_power() +{ + global $BATTERY_POWER; + $state = read_acpi_value("/battery/BAT0/state", "charging state"); + $power = read_acpi_value("/battery/BAT0/state", "present rate"); + + if(($end = strpos($power, ' ')) > 0 && $state == "discharging") + $power = substr($power, 0, $end); + + if(!empty($power)) + array_push($BATTERY_POWER, $power); +} function read_acpi_value($point, $match) { $value = ""; |