Skip to content
Snippets Groups Projects
Commit ece09903 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Improvements to postprocessing script

parent 4e94a425
1 merge request!757Memory allocations logger
...@@ -35,12 +35,15 @@ if len(sys.argv) != 2: ...@@ -35,12 +35,15 @@ if len(sys.argv) != 2:
memuse = OrderedDict() memuse = OrderedDict()
labels = {} labels = {}
totalmem = 0 totalmem = 0
process_use = ""
peak = 0.0
with open(sys.argv[1]) as infile: with open(sys.argv[1]) as infile:
print "# tic label MB"
for line in infile: for line in infile:
if line[0] == "#": if line[0] == "#":
if "# Current use:" in line: if "# Current use:" in line:
print line process_use = line[14:-1]
else: else:
tic , adr, rank, step, allocated, label, size = line.split() tic , adr, rank, step, allocated, label, size = line.split()
rank = int(rank) rank = int(rank)
...@@ -70,6 +73,8 @@ with open(sys.argv[1]) as infile: ...@@ -70,6 +73,8 @@ with open(sys.argv[1]) as infile:
# Unmatched free, skip for now. # Unmatched free, skip for now.
doprint = False doprint = False
if doprint: if doprint:
if totalmem > peak:
peak = totalmem
print tic, label, totalmem/(1048576.0) print tic, label, totalmem/(1048576.0)
totals = {} totals = {}
...@@ -81,8 +86,15 @@ for adr in labels: ...@@ -81,8 +86,15 @@ for adr in labels:
else: else:
totals[labels[adr]] = memuse[adr][0] totals[labels[adr]] = memuse[adr][0]
print "# Memory use by label" print "# Aligned memory use by label"
total = 0.0
for label in sorted(totals): for label in sorted(totals):
print "## ", label, totals[label]/(1048576.0) mem = totals[label]/(1048576.0)
total = total + mem
print "## ", label, '{:.3f}'.format(mem)
print "# Total aligned memory still in use : ", '{:.3f}'.format(total), " (MB)"
print "# Peak aligned memory usage : ", '{:.3f}'.format(peak/1048576.0), " (MB)"
if process_use != "":
print "#"
print "# Memory use by process (all/system):", process_use
sys.exit(0) sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment