From 891704a9b443001a2e1b94d63a2bd119105bdc18 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 22 Aug 2019 20:22:35 +0200 Subject: make chattyparser.py an executable plotting a chattymalloc output file --- src/chattyparser.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) mode change 100644 => 100755 src/chattyparser.py (limited to 'src/chattyparser.py') diff --git a/src/chattyparser.py b/src/chattyparser.py old mode 100644 new mode 100755 index 8eba3a2..e63ec70 --- 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(?:\w+)|(?:\(nil\)))" size = "(?P\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]) -- cgit v1.2.3