From 67851964a8ea00ed8d9f7cb94e78d93d8661a23e Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Fri, 24 Sep 2004 14:47:43 +0000 Subject: [PATCH] new gadget : time evaluation ! --- include/auto.prepend.inc.php | 10 ++++++++-- include/xorg.page.inc.php | 11 ++++++----- templates/skin/common.devel.tpl | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/auto.prepend.inc.php b/include/auto.prepend.inc.php index 08ef2e7..b74a4c1 100644 --- a/include/auto.prepend.inc.php +++ b/include/auto.prepend.inc.php @@ -18,10 +18,16 @@ * 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"); diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php index f0f4b02..9113236 100644 --- a/include/xorg.page.inc.php +++ b/include/xorg.page.inc.php @@ -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
', 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@", - "{$m[1]} ERREUR(S) !!!
", $result); + echo str_replace("@HOOK@", + "$total_time{$m[1]} ERREUR(S) !!!
", $result); } else { - echo str_replace("@NB_ERR@", "", $result); + echo str_replace("@HOOK@", "$total_time", $result); } exit; } diff --git a/templates/skin/common.devel.tpl b/templates/skin/common.devel.tpl index 0330c1a..9c3a9ec 100644 --- a/templates/skin/common.devel.tpl +++ b/templates/skin/common.devel.tpl @@ -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}
- Validation : - @NB_ERR@ + @HOOK@ + Validation: CSS   |   références : -- 2.1.4