[pypy-svn] r70658 - in pypy/build/bot2/jsplot: css js test
fijal at codespeak.net
fijal at codespeak.net
Sun Jan 17 17:01:39 CET 2010
Author: fijal
Date: Sun Jan 17 17:01:39 2010
New Revision: 70658
Modified:
pypy/build/bot2/jsplot/css/main.css
pypy/build/bot2/jsplot/js/plot.js
pypy/build/bot2/jsplot/test/jstest_one_any.js
Log:
Refactor things and improve testing coverage
Modified: pypy/build/bot2/jsplot/css/main.css
==============================================================================
--- pypy/build/bot2/jsplot/css/main.css (original)
+++ pypy/build/bot2/jsplot/css/main.css Sun Jan 17 17:01:39 2010
@@ -3,3 +3,7 @@
width: 600px;
height: 300px;
}
+.caption {
+ font-size: 14pt;
+ font-family: Verdana;
+}
Modified: pypy/build/bot2/jsplot/js/plot.js
==============================================================================
--- pypy/build/bot2/jsplot/js/plot.js (original)
+++ pypy/build/bot2/jsplot/js/plot.js Sun Jan 17 17:01:39 2010
@@ -25,22 +25,7 @@
var cpyend = benchresults[benchresults.length - 1][0];
var cpyval = this.plotdata.cpytimes[benchname];
var cpython_results = [[cpystart, cpyval], [cpyend, cpyval]]
- $("#placeholder").append("<p>" + benchname + "</p>");
- $("#placeholder").append("<div class='plot'></div>");
- $.plot($("#placeholder").children(":last"), [benchresults, cpython_results], {
- 'series': {
- 'points': {'show': true},
- 'lines' : {'show': true},
- },
- 'xaxis': {
- 'min': 70630,
- 'max': revnos[revnos.length - 1],
- 'tickDecimals': 0,
- },
- 'yaxis': {
- 'min': 0,
- }
- });
+ this.plot(benchname, benchresults, cpython_results)
}
}
@@ -53,23 +38,61 @@
}
}
-$(document).ready(function() {
+function myplot(benchname, benchresults, cpython_results) {
+ $("#placeholder").append("<p class='caption'>" + benchname + "</p>");
+ $("#placeholder").append("<div class='plot'></div>");
+ var plotinput = [{
+ label: 'pypy-c-jit',
+ data : benchresults,
+ },
+ {
+ label: 'cpython',
+ data : cpython_results
+ }];
+ $.plot($("#placeholder").children(":last"), plotinput, {
+ 'series': {
+ 'points': {'show': true},
+ 'lines' : {'show': true},
+ },
+ 'xaxis': {
+ 'min': 70630,
+ 'tickDecimals': 0,
+ },
+ 'yaxis': {
+ 'min': 0,
+ },
+ 'legend' : {
+ 'position' : 'sw'
+ }
+ });
+}
+
+function collect_data(plot_function, revlist_url, base_url, async)
+{
$.ajax({
- url: JSON_DIR_LIST,
+ url: revlist_url,
dataType: 'html',
success: function(htmlstr) {
var revnos = extract_revnos($(htmlstr));
- collector = new Collector(revnos);
+ var collector = new Collector(revnos);
+ collector.plot = plot_function;
for (var i in revnos) {
- $.getJSON(JSON_DIR_URL + revnos[i] + '.json', function(data) {
+ $.ajax({
+ url: base_url + revnos[i] + '.json',
+ success: function(data) {
collector.collect(data)
+ },
+ dataType: 'json',
+ async: async,
});
}
},
- error: function (a, b, c) {
- console.log(a, b, c);
- },
+ async: async,
});
+}
+
+$(document).ready(function() {
+ collect_data(myplot, JSON_DIR_LIST, JSON_DIR_URL, true);
});
function extract_benchmark_data(data)
Modified: pypy/build/bot2/jsplot/test/jstest_one_any.js
==============================================================================
--- pypy/build/bot2/jsplot/test/jstest_one_any.js (original)
+++ pypy/build/bot2/jsplot/test/jstest_one_any.js Sun Jan 17 17:01:39 2010
@@ -3,8 +3,11 @@
OpenEnd.require("/js/jquery.min.js")
OpenEnd.require("/js/underscore-min.js")
+var expected_benchnames = ['ai', "django", "html5lib", "richards", "rietveld",
+ "slowspitfire", "spambayes"]
+
Tests = {
-test_load_data: function() {
+test_extract_benchmark_data: function() {
var revnos = [70634, 70632];
var loaded_data = [];
for (var i in revnos) {
@@ -22,12 +25,10 @@
[70634, 0.42492904663079994]]);
var benchnames = _.keys(bench_data.results);
benchnames.sort();
- var expected_keys = ['ai', "django", "html5lib", "richards", "rietveld",
- "slowspitfire", "spambayes"]
- aisDeeply(benchnames, expected_keys);
+ aisDeeply(benchnames, expected_benchnames);
var benchnames = _.keys(bench_data.cpytimes);
benchnames.sort();
- aisDeeply(benchnames, expected_keys);
+ aisDeeply(benchnames, expected_benchnames);
ais(bench_data.cpytimes.ai, 0.43372206687940001);
},
@@ -44,5 +45,21 @@
});
var revnos = extract_revnos(dirdoc);
aisDeeply(revnos, [70632, 70634, 70641, 70643]);
+},
+
+test_collect_data: function() {
+ var checkdata;
+ var benchnames = [];
+ function check(benchname, benchresults, cpyresults) {
+ benchnames.push(benchname);
+ if (benchname == "html5lib") {
+ checkdata = [benchresults, cpyresults];
+ }
+ }
+ collect_data(check, "/test/data/dir", "/test/data/", false);
+ aisDeeply(benchnames, expected_benchnames);
+ aisDeeply(checkdata, [[[70632, 18.3431589603], [70634, 18.2035400867],
+ [70641, 19.623087883], [70643, 18.1294131279]],
+ [[70632, 11.7123618126], [70643, 11.7123618126]]]);
}
}
More information about the Pypy-commit
mailing list