aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-08-22 20:22:35 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-08-22 20:30:10 +0200
commit891704a9b443001a2e1b94d63a2bd119105bdc18 (patch)
treeac5c8c9e5a3c31a60c57c45e6d28ff53c8e1771e
parent2364ca102a265b713f423e7c54ccd118bbecd86a (diff)
downloadallocbench-891704a9b443001a2e1b94d63a2bd119105bdc18.tar.gz
allocbench-891704a9b443001a2e1b94d63a2bd119105bdc18.zip
make chattyparser.py an executable plotting a chattymalloc output file
-rwxr-xr-x[-rw-r--r--]src/chattyparser.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/chattyparser.py b/src/chattyparser.py
index 8eba3a2..e63ec70 100644..100755
--- a/src/chattyparser.py
+++ b/src/chattyparser.py
@@ -1,6 +1,9 @@
+#!/usr/bin/env python3
+
import re
import matplotlib.pyplot as plt
import numpy as np
+import sys
ptr = "(?:0x)?(?P<ptr>(?:\w+)|(?:\(nil\)))"
size = "(?P<size>\d+)"
@@ -178,3 +181,12 @@ def plot_hist_ascii(path, hist, calls):
print(binsize.format((b)*16, (b+1)*16-1), end=" ", file=f)
amount = "{:<" + amountmaxlength + "} {:.2f}% {}"
print(amount.format(bins[b], perc, '*'*int(perc/2)), file=f)
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ print("chattyparser: parse chattymalloc output and create size histogram and memory profile", file=sys.stderr)
+ print(f"Usage: {sys.argv[0]} chattymalloc-file", file=sys.stderr)
+ exit(1)
+
+ plot(sys.argv[1])