0 votes
2.7k 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 990 views
0 votes
1 answer 1.7k views
0 votes
1 answer 2.8k views
0 votes
1 answer 1.3k views
asked Jun 22, 2016 in General by mithunrockey (620 points)
0 votes
1 answer 849 views
+1 vote
1 answer 3.7k views
...