-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.py
42 lines (37 loc) · 895 Bytes
/
process.py
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
31
32
33
34
35
36
37
38
39
40
41
42
f = open("hard.txt")
res = ""
d = {}
for line in f.readlines():
if "processor" in line:
res = "P: "
p = line.strip().split(":")[1].strip()
if "physical id" in line:
n = line.strip().split(":")[1].strip()
if "core id" in line:
c = line.strip().split(":")[1].strip()
if "processor" in line or "core id" in line or "physical id" in line:
res += line.strip().split(":")[1].strip()+"\t"
if "core id" in line:
n = int(n)
p = int(p)
c = int(c)
if n not in d:
d[n] = {}
if c not in d[n]:
d[n][c] = []
d[n][c] += [p]
print res
res = ""
for n in sorted(d):
print "NUMA " +str(n)
for c in sorted(d[n]):
print "|-- CORE "+str(c)
print " |-- "+str(d[n][c])
res = ""
for n in sorted(d):
#nt "NUMA " +str(n)
for c in sorted(d[n]):
#print "|-- CORE "+str(c)
for f in d[n][c]:
res+=str(f)+","
print res[:-1]