Make suites versioned (part 2)

This commit is contained in:
Hannes Verschore 2014-05-19 08:07:14 -07:00
Родитель 4184c405d9
Коммит 3a0ba2e2f7
4 изменённых файлов: 41 добавлений и 17 удалений

Просмотреть файл

@ -62,19 +62,21 @@ if (isset($_GET['awake']) && $_GET['awake'] == 'yes') {
}
// Report score of a benchmark total or subtest.
$name = mysql_real_escape_string(GET_string('name'));
$time = mysql_real_escape_string(GET_string('time'));
$suite_id = find_suite(GET_string('suite'));
$mode_id = find_mode(GET_string('mode'));
$run = GET_run_id('run');
if ($name == '__total__') {
$version = GET_string('suite');
if (isset($_GET['version']))
$version = GET_string('version');
$suite_version_id = find_or_add_suite_version(GET_string('suite'), $version);
if (GET_string('name') == '__total__') {
mysql_query("INSERT INTO awfy_score
(run_id, suite_id, mode_id, score)
(run_id, suite_version_id, mode_id, score)
VALUES
($run, $suite_id, $mode_id, $time)")
($run, $suite_version_id, $mode_id, $time)")
or die("ERROR: " . mysql_error());
} else {
$test_id = find_or_add_test($suite_id, $name);
$test_id = find_or_add_test($suite_version_id, GET_string('name'));
mysql_query("INSERT INTO awfy_breakdown
(run_id, mode_id, score, test_id)
VALUES

Просмотреть файл

@ -425,15 +425,24 @@ Display.prototype.createToolTip = function (item, extended) {
var so = extended ? '<strong>' : '';
var sc = extended ? '</strong>' : '';
var x = item.datapoint[0];
var y = item.datapoint[1];
var text = so + 'score: ' + sc + y.toFixed() + '<br>';
// Figure out the line this corresponds to.
var line = this.graph.info[item.seriesIndex];
if (!line)
return;
var text = "";
var x = item.datapoint[0];
var y = item.datapoint[1];
// Show suite version.
if (line.data[x][3]) {
var suiteVersion = AWFYMaster.suiteversions[line.data[x][3]];
text += so + 'suite: ' + sc + suiteVersion + '<br>';
}
// Show score.
text += so + 'score: ' + sc + y.toFixed() + '<br>';
// Find the point previous to this one.
var prev = null;
for (var i = x - 1; i >= 0; i--) {

Просмотреть файл

@ -110,10 +110,6 @@
<p>Is this open source?</p>
<p>Fo' sho', <a href="https://github.com/haytjes/arewefastyet">https://github.com/haytjes/arewefastyet</a></p>
</li>
<li>
<p>Can I still see the original AWFY, from the JaegerMonkey days?</p>
<p>Yup: <a href="http://arewefastyet.com/historic/old-awfy.php">http://arewefastyet.com/historic/old-awfy.php</a></p>
</li>
<li>
<p>Suggestions?</p>
<p><a href="mailto:Hannes Verschore <hverschore@mozilla.com>">e-mail</a></p>

Просмотреть файл

@ -57,12 +57,29 @@ function find_suite($suite)
return intval($row[0]);
}
function find_or_add_test($suite_id, $name)
function find_or_add_suite_version($suite, $version)
{
$query = "select id from awfy_suite_test where suite_id = $suite_id and name = '$name'";
$suite_id = find_suite($suite);
if ($suite_id == -1)
return -1;
$query = "select id from awfy_suite_version where suite_id = $suite_id and name = '$version'";
$results = mysql_query($query);
if (!$results || mysql_num_rows($results) < 1) {
$query = "insert into awfy_suite_test (suite_id, name) values($suite_id, '$name')";
$query = "insert into awfy_suite_version (suite_id, name) values($suite_id, '$version')";
mysql_query($query);
return mysql_insert_id();
}
$row = mysql_fetch_array($results);
return intval($row[0]);
}
function find_or_add_test($suite_version_id, $name)
{
$name = mysql_real_escape_string($name);
$query = "select id from awfy_suite_test where suite_version_id = $suite_version_id and name = '$name'";
$results = mysql_query($query);
if (!$results || mysql_num_rows($results) < 1) {
$query = "insert into awfy_suite_test (suite_version_id, name) values($suite_version_id, '$name')";
mysql_query($query);
return mysql_insert_id();
}