-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathe820guess
More file actions
executable file
·31 lines (25 loc) · 866 Bytes
/
e820guess
File metadata and controls
executable file
·31 lines (25 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/python
# e820guess - Parses an sosreports e820 memory map fields into a human-readable output
# Written by Kyle Walker - kwalker@redhat.com
import sys, os
def loadMap(inputFile):
readData = open(inputFile)
e820 = []; e820Final = 0; nomore = 0
for line in readData:
if nomore == 0 and ("e820" in line and "usable" in line):
e820.append(line)
elif "e820" not in line and len(e820) > 0:
nomore = 1
readData.close()
for x in range(0,len(e820)):
e820[x] = e820[x].rstrip()
e820[x] = filter(None, e820[x].split(" "))
e820[x] = e820[x][6:9]
e820[x].remove("-")
for x in range(0,len(e820)):
e820[x] = (int(e820[x][1],16) - int(e820[x][0],16))
for x in range(0,len(e820)):
e820Final+=e820[x]
print "Roughly %dGb of RAM" % (e820Final/1024/1024/1024)
if len(sys.argv) > 0 and os.path.exists(sys.argv[1]):
loadMap(sys.argv[1])