Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added ibm-acpi support

  • Loading branch information...
commit 19af2a091ceee452cc5ab5febf667d87520992e3 1 parent 9c263c1
@dagwieers authored
Showing with 29 additions and 9 deletions.
  1. +1 −0  ChangeLog
  2. +1 −1  plugins/dstat_clock.py
  3. +27 −8 plugins/dstat_thermal.py
View
1  ChangeLog
@@ -4,6 +4,7 @@
- Changed default (silver) color of delimiter to gray
- Fixed sum() and enumerate() only when it isn't there (Jesse Young)
- Added external plugins dstat_app
+- Added ibm-acpi support to dstat_thermal
* 0.6.2 - Cumbernauld - released 08/03/2006
- Fixed situation where no TERM environment variable was set (William Webber)
View
2  plugins/dstat_clock.py
@@ -6,7 +6,7 @@
class dstat_clock(dstat):
def __init__(self):
self.name = 'clock'
- self.format = ('t', 14, 0)
+ self.format = ('s', 14, 0)
self.nick = ('date/time',)
self.vars = self.nick
View
35 plugins/dstat_thermal.py
@@ -5,17 +5,36 @@ class dstat_thermal(dstat):
def __init__(self):
self.name = 'thermal'
self.format = ('d', 4, 20)
- self.vars = os.listdir('/proc/acpi/thermal_zone/')
-# self.nick = [string.lower(name) for name in self.vars]
- self.nick = []
- for name in self.vars:
- self.nick.append(string.lower(name))
+ if os.path.exists('/proc/acpi/ibm/thermal'):
+ self.namelist = ['cpu', 'pci', 'hdd', 'cpu', 'bat0', 'unk', 'bat1', 'unk']
+ self.nick = []
+ for line in dopen('/proc/acpi/ibm/thermal'):
+ l = string.split(line)
+ for i, name in enumerate(self.namelist):
+ if int(l[i+1]) > 0:
+ self.nick.append(name)
+ self.vars = self.nick
+ elif os.path.exists('/proc/acpi/thermal_zone/'):
+ self.vars = os.listdir('/proc/acpi/thermal_zone/')
+# self.nick = [string.lower(name) for name in self.vars]
+ self.nick = []
+ for name in self.vars:
+ self.nick.append(string.lower(name))
+ else:
+ raise Exception, 'Module needs kernel ACPI or IBM-ACPI support.'
self.init(self.vars, 1)
def extract(self):
- for zone in self.vars:
- for line in dopen('/proc/acpi/thermal_zone/'+zone+'/temperature').readlines():
+ if os.path.exists('/proc/acpi/ibm/thermal'):
+ for line in dopen('/proc/acpi/ibm/thermal'):
l = string.split(line)
- self.val[zone] = int(l[1])
+ for i, name in enumerate(self.namelist):
+ if int(l[i+1]) > 0:
+ self.val[name] = int(l[i+1])
+ elif os.path.exists('/proc/acpi/thermal_zone/'):
+ for zone in self.vars:
+ for line in dopen('/proc/acpi/thermal_zone/'+zone+'/temperature').readlines():
+ l = string.split(line)
+ self.val[zone] = int(l[1])
# vim:ts=4:sw=4
Please sign in to comment.
Something went wrong with that request. Please try again.