virtualx-engine/tools/scripts/memsort.py
Rémi Verschelde ed96689d8c Move various scripts to the "scripts" folder
Thus cleaning up the "tools" folder a bit.

(cherry picked from commit ae9729b6df)
2016-09-18 23:05:00 +02:00

35 lines
372 B
Python

import sys
arg="memdump.txt"
if (len(sys.argv)>1):
arg=sys.argv[1]
f = open(arg,"rb")
l=f.readline()
sum = {}
cnt={}
while(l!=""):
s=l.split("-")
amount = int(s[1])
what=s[2]
if (what in sum):
sum[what]+=amount
cnt[what]+=1
else:
sum[what]=amount
cnt[what]=1
l=f.readline()
for x in sum:
print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x]))