Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ps_mem.py: support Linux kernels >= version 3.0

* scripts/ps_mem.py: Parse 2 digit kernel versions (3.0)
correctly.  Also recognise that kernels >= 3.0 are accurate.
  • Loading branch information...
commit ed0e5465f5c33e501f270f416dabb029cdca6cb0 1 parent a6b3b05
Pádraig Brady authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 scripts/ps_mem.py
14 scripts/ps_mem.py
View
@@ -35,7 +35,7 @@
# Patch from patrice.bouchand.fedora@gmail.com
# V1.9 20 Feb 2008 Fix invalid values reported when PSS is available.
# Reported by Andrey Borzenkov <arvidjaar@mail.ru>
-# V2.4 06 Mar 2011
+# V2.5 08 Aug 2011
# http://github.com/pixelb/scripts/commits/master/scripts/ps_mem.py
# Notes:
@@ -116,8 +116,16 @@ def std_exceptions(etype, value, tb):
#(major,minor,release)
def kernel_ver():
kv=open(proc+"sys/kernel/osrelease", "rt").readline().split(".")[:3]
+ last=len(kv)
+ if last == 2:
+ kv.append('0')
+ last -= 1
for char in "-_":
- kv[2]=kv[2].split(char)[0]
+ kv[last]=kv[last].split(char)[0]
+ try:
+ int(kv[last])
+ except:
+ kv[last]=0
return (int(kv[0]), int(kv[1]), int(kv[2]))
try:
@@ -311,6 +319,8 @@ def shared_val_accuracy():
if (2,6,1) <= kv <= (2,6,9):
return -1
return 0
+ elif kv[0] > 2:
+ return 2
else:
return 1
Please sign in to comment.
Something went wrong with that request. Please try again.