Skip to content

Commit

Permalink
Can now select which versions to display
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeard0531 committed Dec 8, 2009
1 parent 51f0b0f commit 8b915ab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions main_page.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@
<body>
<h1>MongoDB Benchmark Results</h1>

% metric = request.GET.get('metric', 'ops_per_sec')
% versions = request.GET.get('versions', '')

<form action="/">
<label for="metric">Metric</label>
<select name="metric">
%for m in ['ops_per_sec', 'time', 'speedup']:
<option {{"selected" if m == metric else ""}}>{{m}}</option>
%end
</select>
<br />

<label for="versions">Versions (space-separated)</label>
<input type="text" name="versions" value="{{versions}}" />
<br />

<input type="submit" value="Go" />
</form>

Expand Down
10 changes: 8 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ def static_file(filename):
def raw_data():
out = []

cursor = db.raw.find().sort([('name',1), ('mongodb_date',-1)])
versions = request.GET.get('versions', '').split()
if versions:
q = {'mongodb_version': {'$in': versions}}
else:
q = {}

cursor = db.raw.find(q).sort([('name',1), ('mongodb_date',-1)])

name = None
results = []
Expand Down Expand Up @@ -54,7 +60,7 @@ def main_page():
flot_results.append(json.dumps(out))


return template('main_page.tpl', results=results, flot_results=flot_results, metric=metric)
return template('main_page.tpl', results=results, flot_results=flot_results, request=request)


if __name__ == '__main__':
Expand Down

0 comments on commit 8b915ab

Please sign in to comment.