diff options
Diffstat (limited to 'misc/scripts/memsort.py')
-rw-r--r-- | misc/scripts/memsort.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/misc/scripts/memsort.py b/misc/scripts/memsort.py new file mode 100644 index 0000000000..fb636b0f78 --- /dev/null +++ b/misc/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])) |