1.输出时间点
echo date('H:i:s.u') , " start xxxxxxx" , PHP_EOL;
/*
do something
*/
echo date('H:i:s.u') , " end xxxxxxx" , PHP_EOL;
xxxx 写描述, PHP_EOL为换行
2.输出时间段
$callStartTime = microtime(true);
/*
do something
*/
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;
echo 'Call time to do something was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL;
3.输出内存占用情况
echo "Before: " . memory_get_peak_usage() . "\n";
/*
do something
*/
echo "After: " . memory_get_peak_usage() . "\n";