Now this one is simple, everything is already in place in PHP, first just add this line BEFORE the code you want to measure.
$time_start = microtime(true);
Then after your code just use this block and it will output the time in seconds it took to run the code between the 2 blocks.
$time_end = microtime(true);
echo "<div>Took ".($time_end - $time_start)." seconds</div>";