Skip to content

Commit

Permalink
Merge pull request #1035 from BeQ/fix_admin_osx_10.9
Browse files Browse the repository at this point in the history
Fix issue #1034 thanks for fixing this one guys!
  • Loading branch information
skinkie committed Dec 4, 2013
2 parents 9ba9922 + 88f1c71 commit d021376
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions admin/SystemStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def __init__ (self):
self._page_size = int (re.findall("page size of (\d+) bytes", line)[0])

first_line = self.vm_stat_fd.stdout.readline()
if 'spec' in first_line:
if 'comprs' in first_line:
# OSX 10.9, https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/vm_stat.1.html
# free active specul inactive throttle wired prgable faults copy 0fill reactive purged file-backed anonymous cmprssed cmprssor dcomprs comprs pageins pageout swapins swapouts
self.vm_stat_type = 22
elif 'spec' in first_line:
# free active spec inactive wire faults copy 0fill reactive pageins pageout
self.vm_stat_type = 11
else:
Expand Down Expand Up @@ -173,7 +177,11 @@ def to_int (x):
tmp = filter (lambda x: x, line.split(' '))
values = [(to_int(x) * self._page_size) / 1024 for x in tmp]

if self.vm_stat_type == 11:
if self.vm_stat_type == 22:
# free active specul inactive throttle wired prgable faults copy 0fill reactive purged file-backed anonymous cmprssed cmprssor dcomprs comprs pageins pageout swapins swapouts
free, active, spec, inactive, throttle, wired, prgable, faults, copy, fill, reactive, purged, filebacked, anonymous, cmprssed, cmprssor, dcomprs, comprs, pageins, pageout, swapins, swapouts = values
self.mem.total = free + active + spec + inactive + wired
elif self.vm_stat_type == 11:
# free active spec inactive wire faults copy 0fill reactive pageins pageout
free, active, spec, inactive, wired, faults, copy, fill, reactive, pageins, pageout = values
self.mem.total = free + active + spec + inactive + wired
Expand Down

0 comments on commit d021376

Please sign in to comment.