0 votes
2.5k views
in General by
How can I calculate the time taken to execute a page of code?

1 Answer

0 votes
by
If what you are looking for is the wall-clock time, rather than the CPU execution time, then here is simple code to calculate:

Place this at the top of your page

$time_start     = microtime(true);

and this at the very bottom of that page.

echo "<br><b>Process took ". number_format(microtime(true) - $time_start, 2). " seconds.</b>";

and thats it!

Related questions

0 votes
1 answer 601 views
0 votes
1 answer 1.4k views
0 votes
1 answer 2.6k views
0 votes
1 answer 1.1k views
asked Jun 22, 2016 in General by mithunrockey (620 points)
0 votes
1 answer 618 views
+1 vote
1 answer 3.5k views
...