Power-Management

使用電池獲得系統正常執行時間?

  • October 18, 2014

如何知道電池下的系統**正常執行時間?**這樣我就可以獲得電池備份的確切時間uptime顯示完整的正常執行時間(AC/電池)

注意:我使用的是 linux Mint 17。

您可以使用 UDEV 獲取有關係統電池的詳細資訊。

連接到電源

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
 native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0a/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 vendor:               Panasonic
 model:                42T4801
 serial:               624
 power supply:         yes
 updated:              Sat Oct 18 13:17:16 2014 (2 seconds ago)
 has history:          yes
 has statistics:       yes
 battery
   present:             yes
   rechargeable:        yes
   state:               fully-charged
   energy:              80.5788 Wh
   energy-empty:        0 Wh
   energy-full:         80.9892 Wh
   energy-full-design:  84.24 Wh
   energy-rate:         0.00372912 W
   voltage:             12.224 V
   percentage:          99.4933%
   capacity:            96.141%
   technology:          lithium-ion

電池

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
 native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0a/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 vendor:               Panasonic
 model:                42T4801
 serial:               624
 power supply:         yes
 updated:              Sat Oct 18 13:37:36 2014 (22 seconds ago)
 has history:          yes
 has statistics:       yes
 battery
   present:             yes
   rechargeable:        yes
   state:               discharging
   energy:              79.9524 Wh
   energy-empty:        0 Wh
   energy-full:         80.9892 Wh
   energy-full-design:  84.24 Wh
   energy-rate:         17.172 W
   voltage:             11.94 V
   time to empty:       4.7 hours
   percentage:          98.7198%
   capacity:            96.141%
   technology:          lithium-ion
 History (charge):
   1413653856  98.720  discharging
   1413653826  98.893  discharging
   1413653796  99.080  discharging
   1413653766  99.293  discharging
 History (rate):
   1413653856  17.172  discharging
   1413653826  17.399  discharging
   1413653796  17.453  discharging
   1413653766  17.345  discharging

我從來沒有見過任何顯示電池消耗時間的東西,所以你必須從上面的輸出中計算出來。此外,此輸出通常會顯示“充電時間”,這是其通電時間的粗略指標。

引用自:https://unix.stackexchange.com/questions/162875