可以计算每个文件的的执行时间,配置php.ini中的
auto_prepend_file
auto_append_file
加入自动解析页面来获取执行时间

解决方案 »

  1.   

    记录mysql的slow query是常用方法
      

  2.   

    确认你的每一条查询语句都听从了EXPLAIN的建议
      

  3.   

    我用的监测文件。<?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>
    ?>