配置php.ini中的
auto_prepend_file
auto_append_file
加入自动解析页面来获取执行时间

; Automatically add files before or after any PHP document.
auto_prepend_file = monitor_prog.php
auto_append_file = monitor_prog.php

把monitor_prog.php放到包含目录下。

monitor_prog.php

<? php
// print_r($_SERVER);
if  (  ! function_exists ( ' getmicrotime_t ' ) ) {
function  getmicrotime_t(){ 
    
list ( $usec ,   $sec =   explode ( "   " , microtime ()); 
    
return   $usec ;
    
// return ((float)$usec + (float)$sec); 
} // end func 
}
$time1   =   date ( ' Y-m-d H:i:s ' );
$usec   =  getmicrotime_t();
$usec   *=   1000
$time   =   $time1 . "   " . $usec ;


$phpself = $_SERVER [PHP_SELF];
$serverName = $_SERVER [SERVER_NAME];
$documentRoot = $_SERVER [DOCUMENT_ROOT];
$serverAdmin = $_SERVER [SERVER_ADMIN];

$str = $phpself . "  ;time= " . $time . "   ;serverName= " . $serverName . "  ;documentRoot= " . $documentRoot . "  ;email= " . $serverAdmin ;
$fp   =   fopen ( " d:/web/test/include/time.txt " , " ab " );
fwrite ( $fp ,   $str . " \r\n " );
fclose ( $fp );
// <PRE>
?>

等有了一些统计的数据后,写程序进行数据图表分析

Posted on 2006-03-21 09:26  古代  阅读(474)  评论(0编辑  收藏  举报