summaryrefslogtreecommitdiff
path: root/tools/memsort.py
blob: 8ecccae8bd69ed2391d59146283df3499800b75a (plain)
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

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]))