summaryrefslogtreecommitdiff
path: root/tools/scripts/memsort.py
blob: d2e4fe02264284d17fd8021c2da29710456c3e2b (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

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