执行时间,内存消耗
function tmpMicrotimeMemory($desc) { global $_G; $nowMicrotime = microtime(true); if(!isset($_G['startMicrotime'])) { $_G['startMicrotime'] = $nowMicrotime; } echo $desc . '运行时间: ' . ($nowMicrotime - $_G['startMicrotime']); echo "<br>"; echo '内存消耗 ' . memory_get_usage(); echo "<br>"; $_G['startMicrotime'] = $nowMicrotime; }
function proStartTime() {
$mtime1 = explode(" ", microtime());
$startTime = $mtime1[1] + $mtime1[0];
return $startTime;
}
function proEndTime($startTime, $intro) {
$mtime2 = explode(" ", microtime());
$endtime = $mtime2[1] + $mtime2[0];
$totaltime = ($endtime - $startTime);
$totaltime = number_format($totaltime, 7);
echo $intro . " process time: ".$totaltime . '<br/>';
}