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_last_svn_mark = "select revision from bench_svn where mark='$last_mark';";
22 function set_last_svn_mark($a) {
23 global $last_svn_mark;
24 foreach ($a as $k => $v) {
25 $last_svn_mark = trim($v);
28 query($query_last_svn_mark,"set_last_svn_mark");
30 $query_before_last_mark = "select mark from bench where mark <> '$last_mark' order by mark desc limit 1;";
31 $before_last_mark = "";
32 function set_before_last_mark($a) {
33 global $before_last_mark;
34 foreach ($a as $k => $v) {
35 $before_last_mark = $v;
38 query($query_before_last_mark,"set_before_last_mark");
40 $query_before_last_svn_mark = "select revision from bench_svn where mark='$before_last_mark';";
41 $before_last_svn_mark = "";
42 function set_before_last_svn_mark($a) {
43 global $before_last_svn_mark;
44 foreach ($a as $k => $v) {
45 $before_last_svn_mark = trim($v);
48 query($query_before_last_svn_mark,"set_before_last_svn_mark");
51 $quey_all = urlencode("
54 select * from bench order by mark desc***");
56 $query_time_diff = urlencode("
60 b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
61 (b2.timeuser - b1.timeuser) as diff
63 bench as b1, bench as b2
66 b1.options = b2.options and
67 b1.compilation = b2.compilation and
68 b1.result = b2.result and
69 b1.mark = '$before_last_mark' and b2.mark= '$last_mark' and
70 ABS(b2.timeuser - b1.timeuser) > 100
71 order by diff desc***");
73 $query_result_diff = urlencode("
77 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,
78 (b2.timeuser - b1.timeuser) as diff
80 bench as b1, bench as b2
83 b1.options = b2.options and
84 b1.compilation = b2.compilation and
85 b1.result <> b2.result and
86 b1.mark = '$before_last_mark' and b2.mark= '$last_mark'
87 order by test desc***");
89 $query_fail = urlencode("
93 mark, count(distinct test) as fail_no
95 where result = 'fail' group by mark order by mark desc***
99 select distinct mark, test, result
101 where result = 'fail' order by mark desc***");
103 $query_gc = urlencode("
107 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
108 from bench, bench as bench1
110 bench.mark = bench1.mark and
111 bench.test = bench1.test and
112 bench.options = 'gc-on' and
113 bench1.options = 'gc-off' and
114 bench.compilation = bench1.compilation
120 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
121 from bench, bench as bench1
123 bench.mark = bench1.mark and
124 bench.test = bench1.test and
125 bench.options = 'gc-on' and
126 bench1.options = 'gc-off' and
127 bench.compilation = bench1.compilation and
128 bench.compilation = 'opt'
131 $query_auto = urlencode("
135 mark, SUM(bench.time) as time
139 test='auto.ma' and options = 'gc-on'
141 order by mark desc***
146 mark, SUM(bench.time) as time
150 test='auto.ma' and options = 'gc-off'
158 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
160 bench, bench as bench1
162 bench.mark = bench1.mark and
163 bench.test = bench1.test and
164 bench.options = 'gc-on' and
165 bench1.options = 'gc-off' and
166 bench.compilation = bench1.compilation and
167 bench.test = 'auto.ma'
171 $query_csc = urlencode("
172 Performances per mark
175 bench_times_opt.mark as mark,
177 bench_times_opt.time as time_opt,
178 bench_times_opt.timeuser as timeuser_opt,
179 bench_times_opt.tests as tests_opt,
180 bench_fails_opt.count as fail_opt
184 b1.mark as mark, SUM(b1.time) as time,
185 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
188 b1.options = 'gc-on' and
189 b1.compilation = 'opt'
190 group by b1.mark) as bench_times_opt,
193 SUM(if(b1.result='fail' and b1.compilation='opt' and b1.options='gc-on',1,0))
196 group by b1.mark) as bench_fails_opt
198 bench_times_opt.mark = bench_fails_opt.mark and
199 bench_svn.mark = bench_times_opt.mark
200 order by bench_svn.mark desc
203 $query_total = urlencode("
207 COUNT(DISTINCT test) as MAX
214 Number of compiled tests
218 COUNT(DISTINCT test) as N
225 function minus1_to_all($s){
232 function links_of($name,$q,$limits){
233 echo "<li>$name : ";
234 if (strpos($q, urlencode("***")) === false) {
235 echo "<a href=\"showquery.php?query=$q;\">all</a>";
237 foreach($limits as $l) {
238 $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q);
239 echo "<a href=\"showquery.php?query=$q1;\">" .
240 minus1_to_all($l) . "</a> ";
242 $q1 = str_replace(urlencode("***"), " ", $q);
243 echo "<a href=\"showquery.php?query=$q1;\">" .
244 minus1_to_all("-1") . "</a> ";
249 function last_commits() {
250 global $last_svn_mark;
251 global $before_last_svn_mark;
252 $query = "svn log -r$last_svn_mark:$before_last_svn_mark -v svn://mowgli.cs.unibo.it/trunk/helm/software";
256 foreach ($res as $k => $v) { echo "$v\n"; }
264 <link type="text/css" rel="stylesheet" href="style.css"/>
267 <h1>QUERY the benchmark system</h1>
268 <h2>Last Commits</h2>
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"); $i=0; ?>
364 <tr><td>'bench_svn' table description:</td></tr>
366 <? query("describe bench_svn","printer"); $i=0; ?>
370 SQL (only one query, ';' if present must terminate the query, no characters allowed after it):</td></tr>
372 <textarea rows="10" cols="120" name="query"/>
374 b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
375 (b2.timeuser - b1.timeuser) as diff
377 bench as b1, bench as b2
379 b1.test = b2.test and
380 b1.options = b2.options and
381 b1.compilation = b2.compilation and
382 b1.result = b2.result and
383 b1.mark = '<?php echo $before_last_mark ?>' and b2.mark= '<?php echo $last_mark ?>' and
384 ABS(b2.timeuser - b1.timeuser) > 100
390 <input type="submit" value="Submit" class="button" /></td>