]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/scripts/public_html/bench.php
1ee4d9ae46c8556b43dd6c92965abecc6d0f312f
[helm.git] / helm / software / matita / scripts / public_html / bench.php
1 <?php require("common.php"); 
2   
3 // syntax
4 //
5 // queries ::= query | query "###" queries
6 // query ::= name "@@@" sql
7 //
8 $limits = array("20","50","100");
9   
10 $quey_all = urlencode("
11 Whole content:
12 @@@
13 select * from bench order by mark desc***");
14
15 $query_fail = urlencode("
16 Number of failures
17 @@@
18 select 
19   mark, count(distinct test) as fail_no 
20 from bench 
21 where result = 'fail' group by mark order by mark desc***
22 ###
23 Tests failed
24 @@@
25 select distinct mark, test, result 
26 from bench 
27 where result = 'fail' order by mark desc***");
28
29 $query_gc = urlencode("
30 GC usage 
31 @@@
32 select 
33   bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead 
34 from bench, bench as bench1 
35 where 
36   bench.mark = bench1.mark and 
37   bench.test = bench1.test and 
38   bench.options = 'gc-on' and
39   bench1.options = 'gc-off' and 
40   bench.compilation = bench1.compilation 
41 group by mark***
42 ###
43 GC usage (opt)
44 @@@
45 select 
46   bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead 
47 from bench, bench as bench1
48 where 
49   bench.mark = bench1.mark and 
50   bench.test = bench1.test and 
51   bench.options = 'gc-on' and 
52   bench1.options = 'gc-off' and 
53   bench.compilation = bench1.compilation and 
54   bench.compilation = 'opt' 
55 group by mark***
56 ###
57 GC usage (byte)
58 @@@
59 select 
60   bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead 
61 from bench, bench as bench1 
62 where 
63   bench.mark = bench1.mark and
64   bench.test = bench1.test and 
65   bench.options = 'gc-on' and 
66   bench1.options = 'gc-off' and 
67   bench.compilation = bench1.compilation and 
68   bench.compilation = 'byte' 
69 group by mark***");
70
71 $query_auto = urlencode("
72 Auto (with GC)
73 @@@
74 select 
75   mark, SUM(bench.time) as time 
76 from 
77   bench 
78 where 
79   test='auto.ma' and options = 'gc-on' 
80 group by mark 
81 order by mark desc***
82 ### 
83 Auto (without GC)
84 @@@
85 select 
86   mark, SUM(bench.time) as time 
87 from 
88   bench 
89 where 
90   test='auto.ma' and options = 'gc-off' 
91 group by mark 
92 order by mark desc
93 ***
94 ### 
95 GC overhead
96 @@@
97 select 
98   bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead 
99 from 
100   bench, bench as bench1 
101 where 
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.test = 'auto.ma' 
108 group by mark
109 ***");
110
111 $query_csc = urlencode("
112 Performances (byte and GC) per mark
113 @@@
114 select 
115   bench_times.mark as mark,
116   bench_svn.revision,
117   bench_times.time         as time,
118   bench_times.timeuser     as timeuser,
119   bench_times_opt.time     as time_opt,
120   bench_times_opt.timeuser as timeuser_opt,
121   bench_times.tests     as tests,
122   bench_times_opt.tests as tests_opt,
123   bench_fails.count     as fail,
124   bench_fails_opt.count as fail_opt
125 from 
126   bench_svn, 
127   (select 
128     b1.mark as mark, SUM(b1.time) as time, 
129     SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
130    from bench as b1
131    where 
132      b1.options = 'gc-on' and 
133      b1.compilation = 'opt' 
134      group by b1.mark) as bench_times_opt,
135   (select 
136     b1.mark as mark, SUM(b1.time) as time, 
137     SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests
138    from bench as b1
139    where 
140      b1.options = 'gc-on' and 
141      b1.compilation = 'byte' 
142      group by b1.mark) as bench_times,
143   (select
144     b1.mark as mark,
145     SUM(if(b1.result='fail' and b1.compilation='byte' and b1.options='gc-on',1,0))
146     as count
147    from bench as b1
148    group by b1.mark) as bench_fails,
149   (select
150     b1.mark as mark,
151     SUM(if(b1.result='fail' and b1.compilation='opt' and b1.options='gc-on',1,0))
152     as count
153    from bench as b1
154    group by b1.mark) as bench_fails_opt
155 where 
156   bench_times.mark = bench_fails.mark and 
157   bench_times_opt.mark = bench_fails_opt.mark and 
158   bench_times.mark = bench_times_opt.mark and 
159   bench_svn.mark = bench_times.mark 
160   order by bench_svn.mark desc
161 ***");
162
163 $query_total = urlencode("
164 Max N
165 @@@
166 select 
167   COUNT(DISTINCT test) as MAX 
168 from 
169   bench 
170 group by mark 
171 order by MAX desc 
172 LIMIT 0,1;
173 ###
174 Number of compiled tests
175 @@@
176 select 
177   mark, 
178   COUNT(DISTINCT test) as N 
179 from 
180   bench 
181 group by mark 
182 order by mark desc
183 ***");
184
185 function minus1_to_all($s){
186   if ($s == "-1") 
187     return "all";
188   else 
189     return $s;
190 }
191
192 function links_of($name,$q,$limits){
193   echo "<li>$name :&nbsp;&nbsp;&nbsp;";
194   if (strpos($q, urlencode("***")) === false) {
195     echo "<a href=\"showquery.php?query=$q;\">all</a>";
196   } else {
197     foreach($limits as $l) {
198       $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q);
199       echo "<a href=\"showquery.php?query=$q1;\">" . 
200             minus1_to_all($l) . "</a>&nbsp;&nbsp;";
201     }
202       $q1 = str_replace(urlencode("***"), " ", $q);
203       echo "<a href=\"showquery.php?query=$q1;\">" . 
204             minus1_to_all("-1") . "</a>&nbsp;&nbsp;";
205   }
206   echo "</li>";
207 }
208
209 ?>
210
211 <html>
212   <head>
213   <link type="text/css" rel="stylesheet" href="style.css"/>
214   </head>
215   <body>
216     <h1>QUERY the benchmark system</h1>
217     <h2>Common Queries</h2>
218     <p>
219       <ul>
220       <? links_of("Broken tests",$query_fail,$limits) ?>
221       <? links_of("Garbage collector killer",$query_gc,$limits) ?>
222       <? links_of("Auto performances",$query_auto,$limits) ?>
223       <? links_of("Global performances",$query_csc,$limits) ?>
224       <? links_of("Number of compiled tests",$query_total,$limits) ?>
225       <? links_of("All table contents",$quey_all,$limits) ?>
226       </ul>
227     </p>
228     <h2>Custom Query - Simple Interface</h2>
229     <form action="composequery.php" method="get">
230     <table>
231   <tr>
232     <td>Marks:</td>
233     <td> 
234       <select name="mark">";
235         <option value="--">--</option>";
236         <?query("select distinct mark from bench order by mark desc;",
237             "array_to_combo");?>
238       </select>      
239     </td>
240   </tr>
241   <tr>
242     <td>Compilations:</td>
243     <td> 
244       <select name="compilation">";
245         <option value="--">--</option>";
246           <?query("select distinct compilation from bench;","array_to_combo");?>
247       </select>      
248     </td>
249   </tr>
250   <tr>
251     <td>Options:</td>
252     <td>  
253       <select name="options">";
254         <option value="--">--</option>";
255           <?query("select distinct options from bench;","array_to_combo");?>
256       </select>      
257     </td>
258   </tr>
259   <tr>
260     <td>Tests:</td>
261     <td>    
262       <select name="test">";
263         <option value="--">--</option>";
264           <?query("select distinct test from bench order by test;","array_to_combo");?>
265       </select>      
266     </td>
267   </tr>
268   <tr>
269     <td>Test results:</td>
270     <td>
271       <select name="result">";
272         <option value="--">--</option>";
273           <?query("select distinct result from bench;","array_to_combo"); ?>
274       </select>      
275     </td>
276   </tr>
277   <tr>
278     <td>Group By: </td>
279     <td>
280       <select name="groupby">";
281         <option value="--">--</option>";
282         <? array_to_combo(array("mark"));array_to_combo(array("options")); ?>
283       </select>      
284     </td>
285   </tr>
286   <tr>
287     <td>Limit: </td>
288     <td>
289       <select name="limit">";
290         <option value="--">--</option>";
291       <? foreach(array($limits) as $l) {array_to_combo($l);} ?>
292       </select>      
293     </td>
294   </tr>
295   <tr>
296     <td><input type="submit" value="Submit" class="button" /></td>
297   </tr>
298  </table>
299 </form>
300 <h2>Custom Query - raw SQL</h2>
301 <form action="showquery.php" method="get">
302 <table>
303 <tr><td>'bench' table description:</td></tr>
304 </tr>
305 <? query("describe bench","printer"); ?>
306 </tr>
307 <tr><td></td></tr>
308 <tr><td colspan="7">
309 SQL (only one query, ';' if present must terminate the query, no characters allowed after it):</td></tr>
310 <tr><td colspan="7">
311 <textarea rows="10" cols="120" name="query"/>
312 select 
313   b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts
314 from 
315   bench as b1, bench as b2 
316 where 
317   b1.test = b2.test and 
318   b1.options = b2.options and
319   b1.compilation = b2.compilation and 
320   b1.mark = '' and b2.mark= '' and
321   ABS(b1.timeuser - b2.timeuser) &gt; 100;</textarea>
322 </td>
323 </tr>
324 <tr><td>
325 <input type="submit" value="Submit" class="button" /></td>
326 </tr>
327 </table>
328 </form>
329
330 </body>
331 </html>