Skip to content

Instantly share code, notes, and snippets.

@maguec
Created July 6, 2021 20:21
Show Gist options
  • Save maguec/0dc89e681e8aed2d3cad91cfc8534153 to your computer and use it in GitHub Desktop.
Save maguec/0dc89e681e8aed2d3cad91cfc8534153 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import json
f1 = open(sys.argv[1])
f1json = json.load(f1)
for aggregation in ['Sets', 'Gets', 'Totals']:
for stat in ['Count', 'Average Latency', 'Min Latency', 'Max Latency', 'p50.00', 'p99.00', 'p99.90']:
outf = open("{}-{}_{}.dat".format(sys.argv[1], aggregation.lower(), stat.replace(" ", "_")), "w")
outf.write("#{} {} {}\n".format("tick", aggregation.lower(), stat.replace(" ", "_")))
for x in f1json['ALL STATS'][aggregation]['Time-Serie']:
outf.write("{:<4} {}\n".format(x, f1json['ALL STATS'][aggregation]['Time-Serie'][x][stat]))
outf.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment