1 <?php require("common.php");
5 // queries ::= query | query "###" queries
6 // query ::= name "@@@" sql
8 $limits = array("20","50","100");
10 $query_last_mark = "select mark from bench order by mark desc limit 1;";
12 function set_last_mark($a) {
14 foreach ($a as $k => $v) {
18 query($query_last_mark,"set_last_mark");
20 $query_before_last_mark = "select mark from bench where mark <> '$last_mark' order by mark desc limit 1;";
21 $before_last_mark = "";
22 function set_before_last_mark($a) {
23 global $before_last_mark;
24 foreach ($a as $k => $v) {
25 $before_last_mark = $v;
28 query($query_before_last_mark,"set_before_last_mark");
30 $quey_all = urlencode("
33 select * from bench order by mark desc***");
35 $query_diff = urlencode("
39 b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
40 (b2.timeuser - b1.timeuser) as diff
42 bench as b1, bench as b2
45 b1.options = b2.options and
46 b1.compilation = b2.compilation and
47 b1.mark = '$before_last_mark' and b2.mark= '$last_mark' and
48 ABS(b2.timeuser - b1.timeuser) > 100
49 order by diff desc***");
51 $query_fail = urlencode("
55 mark, count(distinct test) as fail_no
57 where result = 'fail' group by mark order by mark desc***
61 select distinct mark, test, result
63 where result = 'fail' order by mark desc***");
65 $query_gc = urlencode("
69 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
70 from bench, bench as bench1
72 bench.mark = bench1.mark and
73 bench.test = bench1.test and
74 bench.options = 'gc-on' and
75 bench1.options = 'gc-off' and
76 bench.compilation = bench1.compilation
82 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
83 from bench, bench as bench1
85 bench.mark = bench1.mark and
86 bench.test = bench1.test and
87 bench.options = 'gc-on' and
88 bench1.options = 'gc-off' and
89 bench.compilation = bench1.compilation and
90 bench.compilation = 'opt'
96 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
97 from bench, bench as bench1
99 bench.mark = bench1.mark and
100 bench.test = bench1.test and
101 bench.options = 'gc-on' and
102 bench1.options = 'gc-off' and
103 bench.compilation = bench1.compilation and
104 bench.compilation = 'byte'
107 $query_auto = urlencode("
111 mark, SUM(bench.time) as time
115 test='auto.ma' and options = 'gc-on'
117 order by mark desc***
122 mark, SUM(bench.time) as time
126 test='auto.ma' and options = 'gc-off'
134 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
136 bench, bench as bench1
138 bench.mark = bench1.mark and
139 bench.test = bench1.test and
140 bench.options = 'gc-on' and
141 bench1.options = 'gc-off' and
142 bench.compilation = bench1.compilation and
143 bench.test = 'auto.ma'
147 $query_csc = urlencode("
148 Performances (byte and GC) per mark
151 bench_times.mark as mark,
153 bench_times.time as time,
154 bench_times.timeuser as timeuser,
155 bench_times_opt.time as time_opt,
156 bench_times_opt.timeuser as timeuser_opt,
157 bench_times.tests as tests,
158 bench_times_opt.tests as tests_opt,
159 bench_fails.count as fail,
160 bench_fails_opt.count as fail_opt
164 b1.mark as mark, SUM(b1.time) as time,
165 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
168 b1.options = 'gc-on' and
169 b1.compilation = 'opt'
170 group by b1.mark) as bench_times_opt,
172 b1.mark as mark, SUM(b1.time) as time,
173 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
176 b1.options = 'gc-on' and
177 b1.compilation = 'byte'
178 group by b1.mark) as bench_times,
181 SUM(if(b1.result='fail' and b1.compilation='byte' and b1.options='gc-on',1,0))
184 group by b1.mark) as bench_fails,
187 SUM(if(b1.result='fail' and b1.compilation='opt' and b1.options='gc-on',1,0))
190 group by b1.mark) as bench_fails_opt
192 bench_times.mark = bench_fails.mark and
193 bench_times_opt.mark = bench_fails_opt.mark and
194 bench_times.mark = bench_times_opt.mark and
195 bench_svn.mark = bench_times.mark
196 order by bench_svn.mark desc
199 $query_total = urlencode("
203 COUNT(DISTINCT test) as MAX
210 Number of compiled tests
214 COUNT(DISTINCT test) as N
221 function minus1_to_all($s){
228 function links_of($name,$q,$limits){
229 echo "<li>$name : ";
230 if (strpos($q, urlencode("***")) === false) {
231 echo "<a href=\"showquery.php?query=$q;\">all</a>";
233 foreach($limits as $l) {
234 $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q);
235 echo "<a href=\"showquery.php?query=$q1;\">" .
236 minus1_to_all($l) . "</a> ";
238 $q1 = str_replace(urlencode("***"), " ", $q);
239 echo "<a href=\"showquery.php?query=$q1;\">" .
240 minus1_to_all("-1") . "</a> ";
249 <link type="text/css" rel="stylesheet" href="style.css"/>
252 <h1>QUERY the benchmark system</h1>
253 <h2>Common Queries</h2>
256 <? links_of("Broken tests",$query_fail,$limits) ?>
257 <? links_of("Time diff",$query_diff,$limits) ?>
258 <? links_of("Garbage collector killer",$query_gc,$limits) ?>
259 <? links_of("Auto performances",$query_auto,$limits) ?>
260 <? links_of("Global performances",$query_csc,$limits) ?>
261 <? links_of("Number of compiled tests",$query_total,$limits) ?>
262 <? links_of("All table contents",$quey_all,$limits) ?>
265 <h2>Custom Query - Simple Interface</h2>
266 <form action="composequery.php" method="get">
271 <select name="mark">";
272 <option value="--">--</option>";
273 <?query("select distinct mark from bench order by mark desc;",
279 <td>Compilations:</td>
281 <select name="compilation">";
282 <option value="--">--</option>";
283 <?query("select distinct compilation from bench;","array_to_combo");?>
290 <select name="options">";
291 <option value="--">--</option>";
292 <?query("select distinct options from bench;","array_to_combo");?>
299 <select name="test">";
300 <option value="--">--</option>";
301 <?query("select distinct test from bench order by test;","array_to_combo");?>
306 <td>Test results:</td>
308 <select name="result">";
309 <option value="--">--</option>";
310 <?query("select distinct result from bench;","array_to_combo"); ?>
317 <select name="groupby">";
318 <option value="--">--</option>";
319 <? array_to_combo(array("mark"));array_to_combo(array("options")); ?>
326 <select name="limit">";
327 <option value="--">--</option>";
328 <? foreach(array($limits) as $l) {array_to_combo($l);} ?>
333 <td><input type="submit" value="Submit" class="button" /></td>
337 <h2>Custom Query - raw SQL</h2>
338 <form action="showquery.php" method="get">
340 <tr><td>'bench' table description:</td></tr>
342 <? query("describe bench","printer"); ?>
346 SQL (only one query, ';' if present must terminate the query, no characters allowed after it):</td></tr>
348 <textarea rows="10" cols="120" name="query"/>
350 b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
351 (b2.timeuser - b1.timeuser) as diff
353 bench as b1, bench as b2
355 b1.test = b2.test and
356 b1.options = b2.options and
357 b1.compilation = b2.compilation and
358 b1.mark = '<?php echo $before_last_mark ?>' and b2.mark= '<?php echo $last_mark ?>' and
359 ABS(b2.timeuser - b1.timeuser) < 100
365 <input type="submit" value="Submit" class="button" /></td>