Skip to content

Commit dcdfa74

Browse files
committed
changing output to json, moving to different rendering for graphs..
1 parent 8c46fde commit dcdfa74

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

benchmark.pyc

2.06 KB
Binary file not shown.

json_benchmark.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python
2+
import pickle
3+
import os
4+
import json
5+
6+
def plot(label, filename):
7+
stat = pickle.load(open(filename))["mem"]["Active"]
8+
stat = [int((int(number) - int(stat[0]))/1024.0) for number in stat]
9+
return {"mem":stat[-1],"program":label,"cpu":len(stat)}
10+
11+
filenames = []
12+
for root, dirs, files in os.walk("output"):
13+
for name in files: filenames.append((root,name))
14+
15+
filenames.sort()
16+
17+
stats=[]
18+
for filename in filenames:
19+
path = filename[0]
20+
name = filename[1]
21+
label = name.replace(".benchmark","")
22+
stat = plot(label, path + "/" + name)
23+
stats.append(stat)
24+
25+
print json.dumps(stats)

pics/benchmark.png

-25 KB
Loading

plot_benchmarks3.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python
2+
import pickle
3+
import numpy as np
4+
import matplotlib
5+
matplotlib.use('Cairo')
6+
import matplotlib.pyplot as plt
7+
import os
8+
import json
9+
10+
fig = plt.figure()
11+
12+
def plot(label, filename):
13+
stat = pickle.load(open(filename))["mem"]["Active"]
14+
stat = [int((int(number) - int(stat[0]))/1024.0) for number in stat]
15+
print "<tr><td>", label, "</td><td>", str(len(stat)), "</td><td>", str(stat[-1]), "</td></tr>"
16+
return (stat[-1],label)
17+
18+
filenames = []
19+
for root, dirs, files in os.walk("output"):
20+
for name in files: filenames.append((root,name))
21+
22+
filenames.sort()
23+
24+
stats=[]
25+
labels=[]
26+
for filename in filenames:
27+
path = filename[0]
28+
name = filename[1]
29+
label = name.replace(".benchmark","")
30+
stat = plot(label, path + "/" + name)
31+
stats.append(stat)
32+
33+
from pylab import *
34+
pos = arange(len(stats))+.25 # the bar centers on the y axis
35+
36+
figure(1)
37+
barh(pos, map(lambda x: x[0], stats), align='center')
38+
yticks(pos, map(lambda x: x[1], stats))
39+
xlabel('Memory Usage (M)')
40+
title('Reading a 135M TSV File into a List of Lists')
41+
grid(True)
42+
plt.savefig("pics/benchmark.png")
43+
44+
45+
#figure(2)
46+
#barh(pos,val, xerr=rand(5), ecolor='r', align='center')
47+
#yticks(pos, ('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
48+
#xlabel('Performance')

0 commit comments

Comments
 (0)