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'
134 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
135 from bench, bench as bench1
137 bench.mark = bench1.mark and
138 bench.test = bench1.test and
139 bench.options = 'gc-on' and
140 bench1.options = 'gc-off' and
141 bench.compilation = bench1.compilation and
142 bench.compilation = 'byte'
145 $query_auto = urlencode("
149 mark, SUM(bench.time) as time
153 test='auto.ma' and options = 'gc-on'
155 order by mark desc***
160 mark, SUM(bench.time) as time
164 test='auto.ma' and options = 'gc-off'
172 bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead
174 bench, bench as bench1
176 bench.mark = bench1.mark and
177 bench.test = bench1.test and
178 bench.options = 'gc-on' and
179 bench1.options = 'gc-off' and
180 bench.compilation = bench1.compilation and
181 bench.test = 'auto.ma'
185 $query_csc = urlencode("
186 Performances (byte and GC) per mark
189 bench_times.mark as mark,
191 bench_times.time as time,
192 bench_times.timeuser as timeuser,
193 bench_times_opt.time as time_opt,
194 bench_times_opt.timeuser as timeuser_opt,
195 bench_times.tests as tests,
196 bench_times_opt.tests as tests_opt,
197 bench_fails.count as fail,
198 bench_fails_opt.count as fail_opt
202 b1.mark as mark, SUM(b1.time) as time,
203 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
206 b1.options = 'gc-on' and
207 b1.compilation = 'opt'
208 group by b1.mark) as bench_times_opt,
210 b1.mark as mark, SUM(b1.time) as time,
211 SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
214 b1.options = 'gc-on' and
215 b1.compilation = 'byte'
216 group by b1.mark) as bench_times,
219 SUM(if(b1.result='fail' and b1.compilation='byte' and b1.options='gc-on',1,0))
222 group by b1.mark) as bench_fails,
225 SUM(if(b1.result='fail' and b1.compilation='opt' and b1.options='gc-on',1,0))
228 group by b1.mark) as bench_fails_opt
230 bench_times.mark = bench_fails.mark and
231 bench_times_opt.mark = bench_fails_opt.mark and
232 bench_times.mark = bench_times_opt.mark and
233 bench_svn.mark = bench_times.mark
234 order by bench_svn.mark desc
237 $query_total = urlencode("
241 COUNT(DISTINCT test) as MAX
248 Number of compiled tests
252 COUNT(DISTINCT test) as N
259 function minus1_to_all($s){
266 function links_of($name,$q,$limits){
267 echo "<li>$name : ";
268 if (strpos($q, urlencode("***")) === false) {
269 echo "<a href=\"showquery.php?query=$q;\">all</a>";
271 foreach($limits as $l) {
272 $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q);
273 echo "<a href=\"showquery.php?query=$q1;\">" .
274 minus1_to_all($l) . "</a> ";
276 $q1 = str_replace(urlencode("***"), " ", $q);
277 echo "<a href=\"showquery.php?query=$q1;\">" .
278 minus1_to_all("-1") . "</a> ";
283 function last_commits() {
284 global $last_svn_mark;
285 global $before_last_svn_mark;
286 $query = "svn log -r$last_svn_mark:$before_last_svn_mark -v svn://mowgli.cs.unibo.it/trunk/helm/software";
290 foreach ($res as $k => $v) { echo "$v\n"; }
298 <link type="text/css" rel="stylesheet" href="style.css"/>
301 <h1>QUERY the benchmark system</h1>
302 <h2>Last Commits</h2>
304 <h2>Common Queries</h2>
307 <? links_of("Broken tests",$query_fail,$limits) ?>
308 <? links_of("Time diff",$query_time_diff,$limits) ?>
309 <? links_of("Result diff",$query_result_diff,$limits) ?>
310 <? links_of("Garbage collector killer",$query_gc,$limits) ?>
311 <? links_of("Auto performances",$query_auto,$limits) ?>
312 <? links_of("Global performances",$query_csc,$limits) ?>
313 <? links_of("Number of compiled tests",$query_total,$limits) ?>
314 <? links_of("All table contents",$quey_all,$limits) ?>
317 <h2>Custom Query - Simple Interface</h2>
318 <form action="composequery.php" method="get">
323 <select name="mark">";
324 <option value="--">--</option>";
325 <?query("select distinct mark from bench order by mark desc;",
331 <td>Compilations:</td>
333 <select name="compilation">";
334 <option value="--">--</option>";
335 <?query("select distinct compilation from bench;","array_to_combo");?>
342 <select name="options">";
343 <option value="--">--</option>";
344 <?query("select distinct options from bench;","array_to_combo");?>
351 <select name="test">";
352 <option value="--">--</option>";
353 <?query("select distinct test from bench order by test;","array_to_combo");?>
358 <td>Test results:</td>
360 <select name="result">";
361 <option value="--">--</option>";
362 <?query("select distinct result from bench;","array_to_combo"); ?>
369 <select name="groupby">";
370 <option value="--">--</option>";
371 <? array_to_combo(array("mark"));array_to_combo(array("options")); ?>
378 <select name="limit">";
379 <option value="--">--</option>";
380 <? foreach(array($limits) as $l) {array_to_combo($l);} ?>
385 <td><input type="submit" value="Submit" class="button" /></td>
389 <h2>Custom Query - raw SQL</h2>
390 <form action="showquery.php" method="get">
392 <tr><td>'bench' table description:</td></tr>
394 <? query("describe bench","printer"); $i=0; ?>
398 <tr><td>'bench_svn' table description:</td></tr>
400 <? query("describe bench_svn","printer"); $i=0; ?>
404 SQL (only one query, ';' if present must terminate the query, no characters allowed after it):</td></tr>
406 <textarea rows="10" cols="120" name="query"/>
408 b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts,
409 (b2.timeuser - b1.timeuser) as diff
411 bench as b1, bench as b2
413 b1.test = b2.test and
414 b1.options = b2.options and
415 b1.compilation = b2.compilation and
416 b1.result = b2.result and
417 b1.mark = '<?php echo $before_last_mark ?>' and b2.mark= '<?php echo $last_mark ?>' and
418 ABS(b2.timeuser - b1.timeuser) > 100
424 <input type="submit" value="Submit" class="button" /></td>