kistters
5/6/2017 - 4:47 AM

performace-mesure.php

<?php
// Inicia
list($usec, $sec) = explode(' ', microtime());
$script_start = (float) $sec + (float) $usec;

//code here

// Termina e exibimos
list($usec, $sec) = explode(‘ ‘, microtime());
$script_end = (float) $sec + (float) $usec;
$elapsed_time = round($script_end – $script_start, 5);
echo 'Elapsed time: ', $elapsed_time, ' secs. Memory usage: ', round(((memory_get_peak_usage(true) / 1024) / 1024), 2), 'Mb';