Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter: Measure Page Load Time

How do I measure the page load time in a CI application that is using Smarty? Right now, I have put benchmark points at the beginning and end of the index() method, but that only measures the execution time of the method, right? I want to know how long it take to fully render a page.

like image 648
StackOverflowNewbie Avatar asked Dec 06 '22 23:12

StackOverflowNewbie


2 Answers

Just insert {elapsed_time} into a html view:

like <p>Page rendered in {elapsed_time} seconds.

When you have a fresh install of Codeigniter, just open the default welcoming page. You can find this line in the footer.

CodeIgniter has a Benchmarking class that is always active, enabling the time difference between any two marked points to be calculated.

An alternate way to show your elapsed time in your view files is to use this pseudo-variable ...

like image 158
kivimango Avatar answered Dec 10 '22 13:12

kivimango


I would point you to the Codeigniter Profiler

When used in conjunction to the Benchmarking, it gives you fairly detailed results, this should be exactly what you are looking for.

make sure you adjust your benchmark points to conform to the profiler specs though.

like image 28
jondavidjohn Avatar answered Dec 10 '22 12:12

jondavidjohn