Skip to content

Commit 9ff2386

Browse files
committed
Add performance test
Add note about default projets to README
1 parent 0733e5a commit 9ff2386

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ and create an environment.
2929
and create a project.
3030
Check the field "Track changes" and, in case you want version control integration, configure the relevant fields.
3131

32+
**Note**: Only executables associated to projects with a checked "track changes" field will be shown in the Overview and Timeline views.
33+
3234
# Saving data
3335
Data is saved POSTing to `http://localhost:8000/result/add/`.
3436

‎tools/test_performance.py‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import timeit, urllib, sys
2+
3+
SPEEDURL = 'http://localhost:8000/'
4+
5+
benchmarks = ['ai', 'django', 'spambayes', 'grid']
6+
7+
def test_overview():
8+
data = {
9+
"trend": 10,
10+
"baseline": 1,
11+
"revision": 73893,
12+
"executable": "1",
13+
"host": "bigdog",
14+
}
15+
params = urllib.urlencode(data)
16+
page= urllib.urlopen(SPEEDURL + 'overview/table/?' + params)
17+
jsonstring = page.read()
18+
page.close()
19+
if not '<table id="results" class="tablesorter">' in jsonstring:
20+
print "bad overview response"
21+
sys.exit(1)
22+
23+
def test_timeline(bench):
24+
data = {
25+
"executables": "1,2,6",
26+
"baseline": "true",
27+
"benchmark": bench,
28+
"host": "bigdog",
29+
"revisions": 200
30+
}
31+
params = urllib.urlencode(data)
32+
page= urllib.urlopen(SPEEDURL + 'timeline/json/?' + params)
33+
jsonstring = page.read()
34+
#print jsonstring
35+
page.close()
36+
if not '"lessisbetter": " (less is better)", "baseline":' in jsonstring \
37+
or not', "error": "None"}' in jsonstring:
38+
print "bad timeline response"
39+
sys.exit(1)
40+
41+
if __name__ == "__main__":
42+
t = timeit.Timer('test_overview()', 'from __main__ import test_overview')
43+
results = t.repeat(20, 1)
44+
print
45+
print "OVERVIEW RESULTS"
46+
print "min:", min(results)
47+
print "avg:", sum(results)/len(results)
48+
print
49+
print "TIMELINE RESULTS"
50+
for bench in benchmarks:
51+
t = timeit.Timer('test_timeline("'+bench+'")', 'from __main__ import test_timeline')
52+
results = t.repeat(20, 1)
53+
print "benchmark =", bench
54+
print "min:", min(results)
55+
print "avg:", sum(results)/len(results)
56+
print

0 commit comments

Comments
 (0)