Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # to be run over the battlemesh netperf data, like:
- # ./np_parse.py "netperf_test3/screenlog.netperf"
- # here's the uuuugly code
- # cat np_parse.py
- #!/usr/bin/python3
- # doc de los atributos de graphviz
- # http://www.graphviz.org/doc/info/attrs.html
- import sys
- from subprocess import getoutput
- if __name__== '__main__':
- np_filename = sys.argv[1]
- np_file = open(np_filename).read()
- protocols = ['batadv', 'babel', 'olsr', 'bmx6']
- ordered_protos = []
- for proto in protocols:
- pos = np_file.find(proto)
- ordered_protos.append([pos, proto])
- ordered_protos = sorted(ordered_protos)
- averages = []
- # print(ordered_protos)
- proto_max = 0
- for i in range(len(ordered_protos)):
- proto = ordered_protos[i][1]
- if i == len(ordered_protos)-1:
- grep_for = ordered_protos[0][1]
- else:
- grep_for = ordered_protos[i+1][1]
- command = "cat %s | grep %s -B 2 | grep 87380 | awk '{print $5}'" % (np_filename, grep_for)
- throughput_list = getoutput(command).split()
- throughputs = [ float(throughput) for throughput in throughput_list ]
- average = sum(throughputs)/len(throughputs)
- # print(proto, average)
- averages.append([proto, average, len(throughputs), max(throughputs)])
- print(sorted(averages))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement