Permalink
Browse files

Improvements to dstat_battery and dstat_cpufreq.

  • Loading branch information...
dagwieers committed Feb 1, 2009
1 parent fc3009b commit 2405e5e000266d16248c0982aec5c8756ff546cd
Showing with 15 additions and 3 deletions.
  1. +3 −1 ChangeLog
  2. +2 −1 plugins/dstat_battery.py
  3. +10 −1 plugins/dstat_cpufreq.py
View
@@ -2,10 +2,12 @@
- Fixed dstat_disk plugin for total calculation on 2.6.25+ kernels (Noel J. Bergman)
- Precompile regular expressions used as a disk filter (self.diskfilter)
- Raise a warning when discovery returns empty
+- Improvements to dstat_battery and dstat_cpufreq
+- Added external dstat_power plugin to show ACPI power usage
* 0.6.9 - Locarno - release 02/12/2008
- Input text color is now gray (again)
-- Added external dstat_luster plugin (Brock Palen, Kilian Vavalotti)
+- Added external dstat_lustre plugin (Brock Palen, Kilian Vavalotti)
- Validate integer values in /proc/swaps (Bert de Bruijn)
- Added VMware guest dstat_vmmemctl plugin (Bert de Bruijn)
- Added internal dstat_fs plugin showing number of open files/inodes
View
@@ -9,14 +9,15 @@
class dstat_battery(dstat):
def __init__(self):
self.name = 'battery'
- self.format = ('f', 4, 34)
+ self.format = ('p', 4, 34)
self.vars = []
for battery in os.listdir('/proc/acpi/battery/'):
for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines():
l = string.split(line)
if len(l) < 2: continue
if l[0] == 'present:' and l[1] == 'yes':
self.vars.append(battery)
+ self.vars.sort()
# self.nick = [string.lower(name) for name in self.vars]
self.nick = []
for name in self.vars:
View
@@ -20,6 +20,7 @@ def __init__(self):
name = os.path.basename(name)
self.vars.append(name)
self.nick.append(string.lower(name))
+ self.nick.sort()
self.init(self.vars, 1)
def check(self):
@@ -40,6 +41,14 @@ def extract(self):
cur = int(l[0])
### Need to close because of bug in sysfs (?)
dclose('/sys/devices/system/cpu/'+cpu+'/cpufreq/scaling_cur_freq')
- self.val[cpu] = cur * 100.0 / max
+ self.cn1[cpu] = self.cn1[cpu] + cur * 100.0 / max
+
+ if op.update:
+ self.val[cpu] = self.cn1[cpu] / tick
+ else:
+ self.val[cpu] = self.cn1[cpu]
+
+ if step == op.delay:
+ self.cn1[cpu] = 0
# vim:ts=4:sw=4:et

0 comments on commit 2405e5e

Please sign in to comment.