From 326511906e3587e0f5590aa3e23a7109e9170010 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 22 Aug 2019 11:30:29 +0200 Subject: return requested_size as numpy array and plot memory in KB --- src/chattyparser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/chattyparser.py b/src/chattyparser.py index 89ab441..8eba3a2 100644 --- a/src/chattyparser.py +++ b/src/chattyparser.py @@ -1,5 +1,6 @@ import re import matplotlib.pyplot as plt +import numpy as np ptr = "(?:0x)?(?P(?:\w+)|(?:\(nil\)))" size = "(?P\d+)" @@ -115,7 +116,7 @@ def parse(path="chattymalloc.txt", coll_size=True, req_size=None, nohist=False): if not valid_line: print("\ninvalid line at", ln, ":", l) - return hist, calls, requested_size + return hist, calls, np.array(requested_size) def plot(path): @@ -133,14 +134,14 @@ def plot(path): def plot_profile(total_sizes, trace_path, plot_path, sizes): x_vals = range(0, len(total_sizes)) - plt.plot(x_vals, total_sizes, marker='', + plt.plot(x_vals, total_sizes / 1000, marker='', linestyle='-', label="Total requested") for s in sizes: _, _, total_size = parse(path=trace_path, nohist=True, req_size=s) - plt.plot(x_vals, total_size, label=s) + plt.plot(x_vals, total_size / 1000, label=s) - plt.legend() + plt.legend(loc="lower center") plt.xlabel("Allocations") plt.ylabel("mem in kb") plt.title("Memusage profile") -- cgit v1.2.3