new gadget : time evaluation !
authorx2000habouzit <x2000habouzit>
Fri, 24 Sep 2004 14:47:43 +0000 (14:47 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 24 Sep 2004 14:47:43 +0000 (14:47 +0000)
include/auto.prepend.inc.php
include/xorg.page.inc.php
templates/skin/common.devel.tpl

index 08ef2e7..b74a4c1 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: auto.prepend.inc.php,v 1.23 2004-09-19 15:50:45 x2000habouzit Exp $
+        $Id: auto.prepend.inc.php,v 1.24 2004-09-24 14:47:43 x2000habouzit Exp $
  ***************************************************************************/
 
-
+function microtime_float() 
+{ 
+    list($usec, $sec) = explode(" ", microtime()); 
+    return ((float)$usec + (float)$sec); 
+} 
+$TIME_BEGIN = microtime_float();
 ini_set('include_path', '/home/x2000habouzit/dev/diogenes/lib/:'.ini_get('include_path'));
 require("config.xorg.inc.php") ;
 require_once("xorg.common.inc.php");
index f0f4b02..9113236 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: xorg.page.inc.php,v 1.42 2004-09-23 18:46:19 x2000habouzit Exp $
+        $Id: xorg.page.inc.php,v 1.43 2004-09-24 14:47:43 x2000habouzit Exp $
  ***************************************************************************/
 
 require("diogenes.core.page.inc.php");
@@ -136,7 +136,7 @@ class XorgPage extends DiogenesCorePage {
     }
 
     function run($append_to_id="") {
-        global $baseurl, $site_dev, $globals;
+        global $baseurl, $site_dev, $globals, $TIME_BEGIN;
         if($this->_page_type == NO_SKIN)
             $this->display($this->_tpl);
         else {
@@ -147,6 +147,7 @@ class XorgPage extends DiogenesCorePage {
                 $this->assign('validate', urlencode($baseurl.'/valid.html'));
 
                $result = $this->fetch('skin/'.$_SESSION['skin'], $id);
+               $total_time = sprintf('Temps total: %.02fs<br />', microtime_float() - $TIME_BEGIN);
                 $fd = fopen($this->cache_dir."valid.html","w");
                 fwrite($fd, $result);
                 fclose($fd);
@@ -155,10 +156,10 @@ class XorgPage extends DiogenesCorePage {
                foreach($val as $h)
                    if(preg_match("/^X-W3C-Validator-Errors: (\d+)$/", $h, $m)) {
                        if($m[1]) {
-                           echo str_replace("@NB_ERR@",
-                               "<span class='erreur'><a href='http://validator.w3.org/check?uri=$baseurl/valid.html&amp;ss=1#result'>{$m[1]} ERREUR(S) !!!</a></span><br />", $result);
+                           echo str_replace("@HOOK@",
+                               "$total_time<span class='erreur'><a href='http://validator.w3.org/check?uri=$baseurl/valid.html&amp;ss=1#result'>{$m[1]} ERREUR(S) !!!</a></span><br />", $result);
                        } else {
-                           echo str_replace("@NB_ERR@", "", $result);
+                           echo str_replace("@HOOK@", "$total_time", $result);
                        }
                        exit;
                    }
index 0330c1a..9c3a9ec 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: common.devel.tpl,v 1.5 2004-08-31 11:25:43 x2000habouzit Exp $
+        $Id: common.devel.tpl,v 1.6 2004-09-24 14:47:43 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -35,8 +35,8 @@
 
 {if $validate}
   <div id="dev">
-    Validation :
-    @NB_ERR@
+    @HOOK@
+    Validation:
     <a href="http://jigsaw.w3.org/css-validator/validator?uri={$validate}">CSS</a>
     &nbsp;&nbsp;|&nbsp;&nbsp;
     références :