Created
October 25, 2012 22:26
-
-
Save StuntsPT/3955859 to your computer and use it in GitHub Desktop.
Quick and dirty script for plotting netperf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import matplotlib.pyplot as plt | |
def makelist(filename): | |
infile = open(filename,'r') | |
data = [] | |
for lines in infile: | |
if lines.startswith("\n"): | |
pass | |
elif lines.strip()[0].isdigit(): | |
data.append(float(lines.strip().split()[-1])) | |
infile.close() | |
avg = (sum(data)/len(data)) | |
outfile = open(filename[:filename.rindex("/")]+"/Averages.txt","a") | |
outfile.write(filename[filename.rindex("/")+1:]) | |
outfile.write(": %s\n" %(avg)) | |
outfile.close() | |
return data | |
def draw_good(): | |
control_good = plt.plot(makelist("/home/francisco/Desktop/Reg_testing/utils/nteperf_lts_good.log")) | |
bugged_good = plt.plot(makelist("/home/francisco/Desktop/Reg_testing/utils/nteperf_bugged_good.log")) | |
patched_good = plt.plot(makelist("/home/francisco/Desktop/Reg_testing/utils/nteperf_patch-2_good.log")) | |
plt.ylabel("Throughput (10^6bits/sec)") | |
plt.xlabel("Iteration") | |
plt.title("Good reception conditions graph") | |
c = plt.Rectangle((0, 0), 1, 1, fc="b") | |
b = plt.Rectangle((0, 0), 1, 1, fc="r") | |
p = plt.Rectangle((0, 0), 1, 1, fc="g") | |
plt.legend([c, b, p], ["Control", "Bugged", "Patched"]) | |
plt.savefig("/home/francisco/Desktop/Reg_testing/utils/Good.png") | |
def draw_poor(): | |
control_poor = plt.plot(makelist("/home/francisco/Desktop/Reg_testing/utils/nteperf_lts_poor.log")) | |
bugged_poor = plt.plot(makelist("/home/francisco/Desktop/Reg_testing/utils/nteperf_bugged_poor.log")) | |
patched_poor = plt.plot(makelist("/home/francisco/Desktop/Reg_testing/utils/nteperf_patch-2_poor.log")) | |
plt.ylabel("Throughput (10^6bits/sec)") | |
plt.xlabel("Iteration") | |
plt.title("Poor reception conditions graph") | |
c = plt.Rectangle((0, 0), 1, 1, fc="b") | |
b = plt.Rectangle((0, 0), 1, 1, fc="r") | |
p = plt.Rectangle((0, 0), 1, 1, fc="g") | |
plt.legend([c, b, p], ["Control", "Bugged", "Patched"]) | |
plt.savefig("/home/francisco/Desktop/Reg_testing/utils/Poor.png") | |
draw_good() | |
#draw_poor() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment