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_time_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.result = b2.result and
48 b1.mark = '$before_last_mark' and b2.mark= '$last_mark' and
49 ABS(b2.timeuser - b1.timeuser) > 100
50 order by diff desc***");
52 $query_result_diff = urlencode("
56 b1.test as test, b1.result as oldresult, b2.result as newresult, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
57 (b2.timeuser - b1.timeuser) as diff
59 bench as b1, bench as b2
62 b1.options = b2.options and
63 b1.compilation = b2.compilation and
64 b1.result <> b2.result and
65 b1.mark = '$before_last_mark' and b2.mark= '$last_mark'
66 order by test desc***");
68 $query_fail = urlencode("
72 mark, count(distinct test) as fail_no
74 where result = 'fail' group by mark order by mark desc***
78 select distinct mark, test, result
80 where result = 'fail' order by mark desc***");
82 $query_gc = urlencode("
86 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
87 from bench, bench as bench1
89 bench.mark = bench1.mark and
90 bench.test = bench1.test and
91 bench.options = 'gc-on' and
92 bench1.options = 'gc-off' and
93 bench.compilation = bench1.compilation
99 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
100 from bench, bench as bench1
102 bench.mark = bench1.mark and
103 bench.test = bench1.test and
104 bench.options = 'gc-on' and
105 bench1.options = 'gc-off' and
106 bench.compilation = bench1.compilation and
107 bench.compilation = 'opt'
113 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
114 from bench, bench as bench1
116 bench.mark = bench1.mark and
117 bench.test = bench1.test and
118 bench.options = 'gc-on' and
119 bench1.options = 'gc-off' and
120 bench.compilation = bench1.compilation and
121 bench.compilation = 'byte'
124 $query_auto = urlencode("
128 mark, SUM(bench.time) as time
132 test='auto.ma' and options = 'gc-on'
134 order by mark desc***
139 mark, SUM(bench.time) as time
143 test='auto.ma' and options = 'gc-off'
151 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
153 bench, bench as bench1
155 bench.mark = bench1.mark and
156 bench.test = bench1.test and
157 bench.options = 'gc-on' and
158 bench1.options = 'gc-off' and
159 bench.compilation = bench1.compilation and
160 bench.test = 'auto.ma'
164 $query_csc = urlencode("
165 Performances (byte and GC) per mark
168 bench_times.mark as mark,
170 bench_times.time as time,
171 bench_times.timeuser as timeuser,
172 bench_times_opt.time as time_opt,
173 bench_times_opt.timeuser as timeuser_opt,
174 bench_times.tests as tests,
175 bench_times_opt.tests as tests_opt,
176 bench_fails.count as fail,
177 bench_fails_opt.count as fail_opt
181 b1.mark as mark, SUM(b1.time) as time,
182 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
185 b1.options = 'gc-on' and
186 b1.compilation = 'opt'
187 group by b1.mark) as bench_times_opt,
189 b1.mark as mark, SUM(b1.time) as time,
190 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
193 b1.options = 'gc-on' and
194 b1.compilation = 'byte'
195 group by b1.mark) as bench_times,
198 SUM(if(b1.result='fail' and b1.compilation='byte' and b1.options='gc-on',1,0))
201 group by b1.mark) as bench_fails,
204 SUM(if(b1.result='fail' and b1.compilation='opt' and b1.options='gc-on',1,0))
207 group by b1.mark) as bench_fails_opt
209 bench_times.mark = bench_fails.mark and
210 bench_times_opt.mark = bench_fails_opt.mark and
211 bench_times.mark = bench_times_opt.mark and
212 bench_svn.mark = bench_times.mark
213 order by bench_svn.mark desc
216 $query_total = urlencode("
220 COUNT(DISTINCT test) as MAX
227 Number of compiled tests
231 COUNT(DISTINCT test) as N
238 function minus1_to_all($s){
245 function links_of($name,$q,$limits){
246 echo "<li>$name : ";
247 if (strpos($q, urlencode("***")) === false) {
248 echo "<a href=\"showquery.php?query=$q;\">all</a>";
250 foreach($limits as $l) {
251 $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q);
252 echo "<a href=\"showquery.php?query=$q1;\">" .
253 minus1_to_all($l) . "</a> ";
255 $q1 = str_replace(urlencode("***"), " ", $q);
256 echo "<a href=\"showquery.php?query=$q1;\">" .
257 minus1_to_all("-1") . "</a> ";
266 <link type="text/css" rel="stylesheet" href="style.css"/>
269 <h1>QUERY the benchmark system</h1>
270 <h2>Common Queries</h2>
273 <? links_of("Broken tests",$query_fail,$limits) ?>
274 <? links_of("Time diff",$query_time_diff,$limits) ?>
275 <? links_of("Result diff",$query_result_diff,$limits) ?>
276 <? links_of("Garbage collector killer",$query_gc,$limits) ?>
277 <? links_of("Auto performances",$query_auto,$limits) ?>
278 <? links_of("Global performances",$query_csc,$limits) ?>
279 <? links_of("Number of compiled tests",$query_total,$limits) ?>
280 <? links_of("All table contents",$quey_all,$limits) ?>
283 <h2>Custom Query - Simple Interface</h2>
284 <form action="composequery.php" method="get">
289 <select name="mark">";
290 <option value="--">--</option>";
291 <?query("select distinct mark from bench order by mark desc;",
297 <td>Compilations:</td>
299 <select name="compilation">";
300 <option value="--">--</option>";
301 <?query("select distinct compilation from bench;","array_to_combo");?>
308 <select name="options">";
309 <option value="--">--</option>";
310 <?query("select distinct options from bench;","array_to_combo");?>
317 <select name="test">";
318 <option value="--">--</option>";
319 <?query("select distinct test from bench order by test;","array_to_combo");?>
324 <td>Test results:</td>
326 <select name="result">";
327 <option value="--">--</option>";
328 <?query("select distinct result from bench;","array_to_combo"); ?>
335 <select name="groupby">";
336 <option value="--">--</option>";
337 <? array_to_combo(array("mark"));array_to_combo(array("options")); ?>
344 <select name="limit">";
345 <option value="--">--</option>";
346 <? foreach(array($limits) as $l) {array_to_combo($l);} ?>
351 <td><input type="submit" value="Submit" class="button" /></td>
355 <h2>Custom Query - raw SQL</h2>
356 <form action="showquery.php" method="get">
358 <tr><td>'bench' table description:</td></tr>
360 <? query("describe bench","printer"); ?>
364 SQL (only one query, ';' if present must terminate the query, no characters allowed after it):</td></tr>
366 <textarea rows="10" cols="120" name="query"/>
368 b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
369 (b2.timeuser - b1.timeuser) as diff
371 bench as b1, bench as b2
373 b1.test = b2.test and
374 b1.options = b2.options and
375 b1.compilation = b2.compilation and
376 b1.result = b2.result and
377 b1.mark = '<?php echo $before_last_mark ?>' and b2.mark= '<?php echo $last_mark ?>' and
378 ABS(b2.timeuser - b1.timeuser) < 100
384 <input type="submit" value="Submit" class="button" /></td>