summaryrefslogtreecommitdiff
path: root/tools/scripts/memsort.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/scripts/memsort.py')
-rw-r--r--tools/scripts/memsort.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/scripts/memsort.py b/tools/scripts/memsort.py
new file mode 100644
index 0000000000..d2e4fe0226
--- /dev/null
+++ b/tools/scripts/memsort.py
@@ -0,0 +1,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]))