Recommanded Free YOUTUBE Lecture: <% selectedImage[1] %>

microtime_float

코드를 작성하다 보면, 페이지 단위로 어느정도의 시간이 소비되었는지를 확인해야 될 때가 있다. 여기에서 좀 나간다면 모듈(:12)단위로까지 소비시간을 확인해서 성능튜닝을 해야될 때도 있다. 이 php(:12) 함수는 micro초 단위가지 시간을 되돌려준다.
function microtime_float()
{
  list($usec, $sec) = explode(" ", microtime());
  return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();
// ----- 측정하고자 하는 영역 시작

// ----------------------------------------
$difftime = $time_end - $time_start;
$difftime = number_format($difftime,5);
echo <<<FOOT
<HR>
Processing Time : $difftime sec
FOOT;
  • 사용예 : http://wowclub.joinc.co.kr/controll.php/testmodule