Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
748b7f3
commit c747d59
Showing
13 changed files
with
1,129 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<title>MongoDB Benchmark Results</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > | ||
<link rel="stylesheet" href="/static/css/page.css"> | ||
|
||
<script src="static/jquery-1.3.2.min.js"></script> | ||
<script src="static/jquery.dataTables.min.js"></script> | ||
<script src="static/jquery.flot.min.js"></script> | ||
<script> | ||
$(document).ready(function(){ | ||
$('table').dataTable({ | ||
"bPaginate": false, | ||
"bLengthChange": false, | ||
"bFilter": false, | ||
"bInfo": false, | ||
"bAutoWidth": true | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<h1>MongoDB Benchmark Results</h1> | ||
|
||
%for k, (outer_result, flot_data) in enumerate(zip(results, flot_results)): | ||
<h2>{{outer_result['name']}}</h2> | ||
|
||
<table class="display"> | ||
<thead> | ||
<tr> | ||
<th>Num</th> | ||
<th>Version</th> | ||
<th>Date</th> | ||
<th>one thread</th> | ||
<th>two threads</th> | ||
<th>four threads</th> | ||
<th>ten threads</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
%for i, result in enumerate(outer_result['results']): | ||
<tr> | ||
<td>{{i}}</td> | ||
<td>{{result['version']}}</td> | ||
<td>{{result['date']}}</td> | ||
<td>{{result['one']['ops_per_sec']}}</td> | ||
<td>{{result['two']['ops_per_sec']}}</td> | ||
<td>{{result['four']['ops_per_sec']}}</td> | ||
<td>{{result['ten']['ops_per_sec']}}</td> | ||
</tr> | ||
%end | ||
</thead> | ||
</table> | ||
|
||
<div id="flot_{{k}}" style="width:600px;height:300px;"> </div> | ||
<script> | ||
$(function(){ | ||
var data = {{flot_data}}; | ||
$.plot( | ||
$('#flot_{{k}}'), data, | ||
{ | ||
series: { lines: { show: true }, points: { show: true } }, | ||
xaxis: {ticks : [1,2,4,10]} | ||
} | ||
); | ||
}); | ||
</script> | ||
|
||
<hr> | ||
%end | ||
|
||
</body> | ||
</html> | ||
|
||
%# vim: set ft=html: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/python | ||
from bottle import * | ||
import pymongo | ||
from datetime import datetime | ||
import sys | ||
import json | ||
|
||
db = pymongo.Connection('localhost', 27017)['bench_results'] | ||
|
||
@route('/static/:filename#.*#') | ||
def static_file(filename): | ||
send_file(filename, root='./static') | ||
|
||
@route("/raw") | ||
def raw_data(): | ||
out = [] | ||
|
||
cursor = db.raw.find().sort([('name',1), ('mongodb_date',-1)]) | ||
|
||
name = None | ||
results = [] | ||
for result in cursor: | ||
if result['name'] != name: | ||
if name is not None: | ||
out.append({'name':name, 'results':results}) | ||
name = result['name'] | ||
results = [] | ||
results.append(dict(version=result['mongodb_version'] | ||
,date=result['mongodb_date'] | ||
,one=result['results']['one'] | ||
,two=result['results']['two'] | ||
,four=result['results']['four'] | ||
,ten=result['results']['ten'] | ||
)) | ||
|
||
out.append({'name':name, 'results':results}) | ||
return out | ||
|
||
@route("/") | ||
def main_page(): | ||
results = raw_data() | ||
|
||
flot_results = [] | ||
for outer_result in results: | ||
out = [] | ||
for i, result in enumerate(outer_result['results']): | ||
out.append({'label': result['version'], | ||
'data': [[1, result['one']['ops_per_sec']], | ||
[2, result['two']['ops_per_sec']], | ||
[4, result['four']['ops_per_sec']], | ||
[10, result['ten']['ops_per_sec']]]}) | ||
flot_results.append(json.dumps(out)) | ||
|
||
|
||
return template('main_page.tpl', results=results, flot_results=flot_results) | ||
|
||
|
||
if __name__ == '__main__': | ||
do_reload = '--reload' in sys.argv | ||
debug(do_reload) | ||
run(reloader=do_reload) | ||
|
||
|
||
|
||
|
Oops, something went wrong.