Skip to content

Commit

Permalink
Generate latency graphs and integrate them into the page.
Browse files Browse the repository at this point in the history
  • Loading branch information
ms705 committed Jan 22, 2012
1 parent a5575de commit 74254a4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
40 changes: 32 additions & 8 deletions web/processing/gen-details-page.py
Expand Up @@ -62,17 +62,23 @@
os_string = "unknown"
for line in open(data_dir + "/logs/uname").readlines():
fields = line.split()
os = fields[0]
os_id = fields[0]
ver = fields[1]
arch = fields[2]
os_string = "%s %s, %s" % (os, ver, arch)
os_string = "%s %s, %s" % (os_id, ver, arch)

# Generate latency graphs
l = os.listdir(results_dir + "/lat")
for lat_file in l:
print lat_file
argv = ["python", "plot_lat.py", results_dir + "/lat/" + lat_file, lat_file]
subprocess.check_call(argv)
lat_ls = None
try:
lat_ls = os.listdir(results_dir + "/lat")
for lat_file in lat_ls:
if not re.search("\.csv", lat_file):
continue
argv = ["python", "plot_lat.py", results_dir + "/lat/" + lat_file, \
lat_file, data_dir + "/graphs", str(len(processor_ids))]
subprocess.check_call(argv)
except:
pass

# Generate throughput graphs
argv = ["python", "plot_thr.py", results_dir, target_cpus, "0"]
Expand All @@ -98,8 +104,26 @@
out_html = out_html + html

# Generate latency heatmap section
html = "<h2>Latency</h2><p>To be added.</p>"
html = "<h2>Latency</h2>"
html = html + "<p>These graphs show the pairwise IPC latency between cores."
html = html + "<table><tr>"
thr_graphs_links = ""
i = 0
graphs_per_row = 3
if lat_ls is None:
html = html + "<td><b><em>No data.</em></b></td>"
else:
for t in lat_ls:
if not re.search("\.csv", t):
continue
graph_file = "../graphs/%s/lat_%s.png" % (name, t)
if i % graphs_per_row == 0:
html = html + "</tr><tr>"
html = html + "<td><a href=\"%s\"><img src=\"%s\" /></a></td>" \
% (graph_file, graph_file)
i = i + 1

html = html + "</tr></table>"
out_html = out_html + html

# Generate throughput graphs section
Expand Down
21 changes: 13 additions & 8 deletions web/processing/plot_lat.py
Expand Up @@ -6,7 +6,7 @@
import numpy.random
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import pylab
import pylab as pyl

def get_data(filename):
data = np.loadtxt(filename)
Expand All @@ -30,19 +30,24 @@ def get_data(filename):
# Handle command line args

if len(sys.argv) < 2:
print "usage: python plot_lat.py <input file> <title> [fix-scale]"
print "usage: python plot_lat.py <input file> <title> <output_dir> <num_cores> [fix-scale]"
sys.exit(0)

input_file = sys.argv[1]

fix_scale = 0
if len(sys.argv) > 3:
fix_scale = int(sys.argv[3])
if len(sys.argv) > 5:
fix_scale = int(sys.argv[5])

num_cores = int(sys.argv[4])

output_dir = sys.argv[3]

raw_data = np.loadtxt(input_file)
data = get_data(input_file)

fig = plt.figure(figsize=(4,3))
fig = plt.figure(figsize=(3,2))
pyl.rc('font', size='8.0')
#f = pylab.Figure(figsize=(2,1.5))
# print ds
#heatmap, xedges, yedges = np.histogram2d(data[0], data[1], bins=48, weights=data[2])
Expand All @@ -61,13 +66,13 @@ def get_data(filename):

# add some
plt.ylabel('Core ID')
plt.ylim(0, 48)
plt.ylim(-0.5, int(sys.argv[4])-0.5)
plt.xlabel('Core ID')
plt.xlim(0, 48)
plt.xlim(-0.5, int(sys.argv[4])-0.5)
plt.title(sys.argv[2])

cb = plt.colorbar(shrink=1.0, format='%.3e')
cb.set_label('Latency in microseconds')

#plt.savefig("lat_" + sys.argv[1] + ".pdf", format="pdf", bbox_inches='tight')
plt.savefig(out_dir + "/lat_" + sys.argv[1] + ".png", format="png", bbox_inches='tight')
plt.savefig(output_dir + "/lat_" + sys.argv[2] + ".png", format="png", bbox_inches='tight')

0 comments on commit 74254a4

Please sign in to comment.