diff --git a/test/heapwatch/block_history_plot.py b/test/heapwatch/block_history_plot.py index d8c86b454f..8d80092462 100644 --- a/test/heapwatch/block_history_plot.py +++ b/test/heapwatch/block_history_plot.py @@ -23,6 +23,7 @@ # Graph over time of TPS or 10-round-moving-average-TPS import base64 +import json import os import statistics import sys @@ -85,10 +86,11 @@ def process(path, args): else: tsv.append(_time) if dt > 0.5: + dt = round(dt, 3) dtxn = tc - prevtc if dtxn < 0: sys.stderr.write(f'{path}:{count} tc {tc}, prevtc {prevtc}, rnd {rnd}, prevrnd {prevrnd}\n') - tps = dtxn / dt + tps = round(dtxn / dt, 3) mintxn = min(dtxn,mintxn) maxtxn = max(dtxn,maxtxn) mindt = min(dt,mindt) @@ -106,12 +108,25 @@ def process(path, args): prevtc = tc prevts = ts prevtime = _time - print('{} blocks, block txns [{}-{}], block seconds [{}-{}], tps [{}-{}]'.format( + print('{} blocks, block txns [{}-{}], block seconds [{}-{}], tps [{}-{}], total txns {}'.format( count, mintxn,maxtxn, mindt,maxdt, mintps,maxtps, + tc, )) + if tc > 0: + with open(path + '.stats', 'w') as fout: + fout.write(json.dumps({ + 'blocks': count, + 'tc': tc, + 'mintxn': mintxn, + 'maxtxn': maxtxn, + 'mindt': mindt, + 'maxdt': maxdt, + 'mintps': mintps, + 'maxtps': maxtps, + })) start = 0 end = len(txnv)-1