"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_power.py" between
dstat-0.7.3.tar.gz and dstat-0.7.4.tar.gz

About: dstat is a versatile resource statistic tool and a replacement for vmstat, iostat and ifstat (using Python).

dstat_power.py  (dstat-0.7.3):dstat_power.py  (dstat-0.7.4)
skipping to change at line 30 skipping to change at line 30
self.batteries = [] self.batteries = []
for battery in os.listdir('/proc/acpi/battery/'): for battery in os.listdir('/proc/acpi/battery/'):
for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines( ): for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines( ):
l = line.split() l = line.split()
if len(l) < 2: continue if len(l) < 2: continue
self.batteries.append(battery) self.batteries.append(battery)
break break
def check(self): def check(self):
if not self.batteries: if not self.batteries:
raise Exception, 'No battery information found, no power usage stati stics' raise Exception('No battery information found, no power usage statis tics')
def extract(self): def extract(self):
amperes_drawn = 0 amperes_drawn = 0
voltage = 0 voltage = 0
watts_drawn = 0 watts_drawn = 0
for battery in self.batteries: for battery in self.batteries:
for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines( ): for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines( ):
l = line.split() l = line.split()
if len(l) < 3: continue if len(l) < 3: continue
if l[0] == 'present:' and l[1] != 'yes': continue if l[0] == 'present:' and l[1] != 'yes': continue
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)