]> matita.cs.unibo.it Git - helm.git/commitdiff
fix
authorEnrico Tassi <enrico.tassi@inria.fr>
Thu, 16 Mar 2006 13:04:42 +0000 (13:04 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Thu, 16 Mar 2006 13:04:42 +0000 (13:04 +0000)
helm/software/matita/scripts/public_html/bench.php
helm/software/matita/scripts/public_html/common.php
helm/software/matita/scripts/public_html/composequery.php
helm/software/matita/scripts/public_html/showquery.php

index 2ee5408257b42e1fb11aa1ac20505deac8a0e501..ed5572b9f827415b3e7c4c4e70babc0be41295f1 100644 (file)
@@ -17,27 +17,27 @@ $query_fail = urlencode(
 );
 $query_gc = urlencode(
   "GC usage @@@" .
-  "select bench.mark, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time)) - SUM(TIME_TO_SEC(bench1.time))) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation group by mark***"
+  "select bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation group by mark***"
   . "###" . 
   "GC usage (opt)@@@" .
-  "select bench.mark, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time)) - SUM(TIME_TO_SEC(bench1.time))) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation and bench.compilation = 'opt' group by mark***"
+  "select bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation and bench.compilation = 'opt' group by mark***"
   . "###" . 
   "GC usage (byte)@@@" .
-  "select bench.mark, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time)) - SUM(TIME_TO_SEC(bench1.time))) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation and bench.compilation = 'byte' group by mark***"
+  "select bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation and bench.compilation = 'byte' group by mark***"
   
 );
 $query_auto = urlencode(
-  "Auto (with GC)@@@select mark, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time))) as time from bench where test='auto.ma' and options = 'gc-on' group by mark order by mark desc***"
+  "Auto (with GC)@@@select mark, SUM(bench.time) as time from bench where test='auto.ma' and options = 'gc-on' group by mark order by mark desc***"
   . "###" . 
-  "Auto (without GC)@@@select mark, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time))) as time from bench where test='auto.ma' and options = 'gc-off' group by mark order by mark desc***"
-  #  . "###" . 
-  # "GC overhead@@@select bench.mark, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time)) - SUM(TIME_TO_SEC(bench1.time))) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation and bench.test = 'auto.ma' group by mark"
+  "Auto (without GC)@@@select mark, SUM(bench.time) as time from bench where test='auto.ma' and options = 'gc-off' group by mark order by mark desc***"
+    . "###" . 
+   "GC overhead@@@select bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead from bench, bench as bench1 where bench.mark = bench1.mark and bench.test = bench1.test and bench.options = 'gc-on' and bench1.options = 'gc-off' and bench.compilation = bench1.compilation and bench.test = 'auto.ma' group by mark"
 );
 
-$query_csc = urlencode("Performances (byte and GC) per mark@@@select bench.mark ,bench_svn.revision as revision, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time))) as sum_time, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.timeuser))) as sum_timeuser from bench, bench_svn where bench.options = 'gc-on' and bench.compilation = 'byte' and bench_svn.mark = bench.mark group by bench.mark order by bench.mark desc"
+$query_csc = urlencode("Performances (byte and GC) per mark@@@select bench.mark ,bench_svn.revision as revision, SUM(bench.time) as sum_time, SUM(bench.timeuser) as sum_timeuser from bench, bench_svn where bench.options = 'gc-on' and bench.compilation = 'byte' and bench_svn.mark = bench.mark group by bench.mark order by bench.mark desc"
 );
 
-$query_csc_opt = urlencode("Performances (opt and GC) per mark@@@select bench.mark,bench_svn.revision as revision, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.time))) as sum_time, SEC_TO_TIME(SUM(TIME_TO_SEC(bench.timeuser))) as sum_timeuser from bench, bench_svn where bench.options = 'gc-on' and bench.compilation = 'opt' and bench_svn.mark = bench.mark group by bench.mark order by bench.mark desc"
+$query_csc_opt = urlencode("Performances (opt and GC) per mark@@@select bench.mark,bench_svn.revision as revision, SUM(bench.time) as sum_time, SUM(bench.timeuser) as sum_timeuser from bench, bench_svn where bench.options = 'gc-on' and bench.compilation = 'opt' and bench_svn.mark = bench.mark group by bench.mark order by bench.mark desc"
 );
 
 $query_total = urlencode(
index f2a9be030ea5e26c36788fa13b2bbbd8c9945baa..5b9f51e5dc68cc488bb66d2b4ee79528a2ebf3bc 100644 (file)
@@ -1,28 +1,17 @@
 <?php
 
-function query($q) {
+function query($q,$f) {
   $db = mysql_pconnect("localhost","helm");
   mysql_select_db("matita");
-  if (preg_match("/TIME_TO_SEC/",$q)) {
-    $group_by = true;
-    $q = preg_replace("/group by bench.mark/","",$q);
-    $q = preg_replace("/SEC_TO_TIME\(SUM\(TIME_TO_SEC\(([^)]+)\)\)\)/","$1",$q);
-  }
   $rc = mysql_query($q,$db);
   if(!$rc) {
     die("Query failed: " . mysql_error());
   }
-  $result = array();
   while( $row = mysql_fetch_array($rc, MYSQL_ASSOC)){
-    $result[] = $row;
+    $f($row);
   }
   mysql_free_result($rc);
   mysql_close($db);
-  if ($group_by){
-    return group_array_by_mark($result);
-  } else {
-    return $result;
-  }
 }
 
 function time_2_cents($t) {
@@ -36,45 +25,6 @@ function time_2_cents($t) {
   return ((int) $t_cents) + ((int) $t_secs) * 100 + ((int)$t_minutes) * 6000 ;
 }
 
-function sum_time($t1, $t2) {
-  $matches1 = array();
-  $matches2 = array();
-  $rex = "/^(\d+)m(\d\d?)\.(\d{2})s$/";
-  $m1 = preg_match($rex,$t1,$matches1);
-  $m2 = preg_match($rex,$t2,$matches2);
-  if ($m1 != 0 && $m2 != 0) {
-    $t1_minutes = $matches1[1];
-    $t2_minutes = $matches2[1];
-    $t1_secs = $matches1[2];
-    $t2_secs = $matches2[2];
-    $t1_cents = $matches1[3];
-    $t2_cents = $matches2[3];
-    $time1 = ((int) $t1_cents) + ((int) $t1_secs) * 100 + ((int)$t1_minutes) * 6000 ;
-    $time2 = ((int) $t2_cents) + ((int) $t2_secs) * 100 + ((int)$t2_minutes) * 6000 ;
-    $sum = $time1 + $time2;
-    $min = $sum / 6000;
-    $sec = ($sum % 6000) / 100;
-    $cent = ($sum % 6000) % 100;
-    return sprintf("%dm%02d.%02ds",$min,$sec,$cent);
-  } else {
-    return $t1;
-  }
-}
-
-function group_array_by_mark($a) {
-  $rc = array();
-  foreach ($a as $x) {
-    if ($rc[$x['mark']] == NULL) {
-      $rc[$x['mark']] = $x;
-    } else {
-      foreach ($rc[$x['mark']] as $k => $v) {
-        $rc[$x['mark']][$k] = sum_time($v, $x[$k]);
-      }
-    }
-  }
-  return array_values($rc);
-}
-  
 function array_to_combo($l,$a) {
   echo "<select name=\"$l\">";
   echo "<option value=\"--\">--</option>";
index 49a943e47b61f5f443de93261ccec984078c3822..1c7366dea564b72062741aff6f288ebe1cfec02d 100644 (file)
@@ -23,7 +23,7 @@
   $gb = $_GET['groupby'];
   $limit = $_GET['limit'];
   if($gb != "--")
-    $what = "mark, SEC_TO_TIME(SUM(TIME_TO_SEC(time))) as sum_time, SEC_TO_TIME(SUM(TIME_TO_SEC(timeuser))) as sum_timeuser";
+    $what = "mark, SUM(time) as sum_time, SUM(timeuser) as sum_timeuser";
   else
     $what = "mark, time, timeuser, compilation, test, result, options";
   $clause = clause_for($c);
index e7db764d80e78d5f529490668a674b23386a5a83..1e385d46ee1ad57e86584aaeaf40def1670671bb 100644 (file)
@@ -22,26 +22,15 @@ function prettify($s) {
     return $s;
 }
   
-?>
-<html>
-  <head>
-  <link type="text/css" rel="stylesheet" href="style.css"/>
-  </head>
-  <body>
-    <h1>QUERY results</h1>
-<? foreach( $qs as $name => $q) { ?>
-    <h2><? echo $name; ?></h2>
-    <p>
-    <tt><? print $q; ?></tt>
-    </p>
-    <table border=1>
-    <? 
-      $q = query($q);
+function printer($q){
+  static $i = 0;
+  if ( $i == 0) {
       echo "<tr>";
-      foreach( $q[0] as $name => $txt) {
+      foreach( $q as $name => $txt) {
           echo "<th>$name</th>";
         }
       echo "</tr>\n";
+  } else {
       $i=0;
       foreach ($q as $k => $v) {
         $i = $i + 1;
@@ -54,7 +43,24 @@ function prettify($s) {
         }
         echo "</tr>\n";      
       }
-    ?>
+  }
+  $i++;
+}
+
+?>
+<html>
+  <head>
+  <link type="text/css" rel="stylesheet" href="style.css"/>
+  </head>
+  <body>
+    <h1>QUERY results</h1>
+<? foreach( $qs as $name => $q) { ?>
+    <h2><? echo $name; ?></h2>
+    <p>
+    <tt><? print $q; ?></tt>
+    </p>
+    <table border=1>
+    <?  query($q,&$printer); ?>
     </table>
 <? } ?>
     <p><a href="bench.php">BACK to the query page</a></p>