From ce31d71a82d33a78f56261e18339da016e84adbb Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 11 Sep 2014 15:49:11 +1000 Subject: [PATCH] php - add a php runtime stat --- pool/page.php | 15 +++++++++++---- pool/prime.php | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pool/page.php b/pool/page.php index 54eafadd..d042864a 100644 --- a/pool/page.php +++ b/pool/page.php @@ -133,6 +133,7 @@ h1 {margin-top: 20px; float:middle; font-size: 20px;} .st1 {color:red; font-weight:bold; } .st2 {color:green; font-weight:bold; } .st3 {color:blue; font-weight:bold; } +.ft {color:blue; font-size:7px; } \n"; $head .= ''; @@ -431,7 +432,7 @@ function pgfoot() $now = date('Y'); if ($now != '2014') $foot .= "-$now"; - $foot .= ''; + $foot .= ' Z/s'; $foot .= "\n"; return $foot; @@ -439,7 +440,7 @@ function pgfoot() # function gopage($data, $pagefun, $page, $menu, $name, $user, $ispage = true, $dotop = true, $douser = true) { - global $dbg; + global $dbg, $stt; global $page_scripts; $dbg_marker = '[@dbg@]'; @@ -473,11 +474,17 @@ function gopage($data, $pagefun, $page, $menu, $name, $user, $ispage = true, $do $all = $head; $all .= trm_force($body); $all .= trm($pg); - $all .= trm_force($foot); + + if (isset($_SERVER["REQUEST_TIME_FLOAT"])) + $elapsed = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]; + else + $elapsed = microtime(true) - $stt; + + $foot = trm_force(str_replace('Z/', number_format($elapsed, 4), $foot)); usleep(100000); - echo $all; + echo $all.$foot; exit(0); } diff --git a/pool/prime.php b/pool/prime.php index ab73a08e..55fba0b0 100644 --- a/pool/prime.php +++ b/pool/prime.php @@ -1,5 +1,8 @@