Professional CodeIgniter, Thomas Myer
Chapter 9: Security and Performance
291
To start off, open up your footer view (/system/application/views/footer.php), and add the following
code to the file:
Copyright  
< 
?php echo date("Y"); ? 
> 
< 
?php echo anchor("welcome/privacy","privacy policy");? 
> 
& 
nbsp; 
& 
nbsp; 
& 
nbsp;
< 
?php echo anchor("welcome/verify","dashboard");? 
> 
& 
nbsp; 
& 
nbsp; 
& 
nbsp; 
< 
?php echo $this- 
> 
benchmark- 
> 
elapsed_time();? 
> 
& 
nbsp; 
& 
nbsp; 
& 
nbsp; 
< 
?php echo $this- 
> 
benchmark- 
> 
memory_usage();? 
> 
 The   
elapsed_time()
function will tell you how much time it took to render a page, from CodeIgniter
framework initialization all the way through final output to the browser. The  
memory_usage()
   function 
will tell you how much memory was used. 
 Once  you ' ve loaded the view onto your site, visit one of the category pages. Remember, the home page is 
cached, so it ' s better to visit an uncached page. You should see something like Figure 9 - 3 .
cached, so it ' s better to visit an uncached page. You should see something like Figure 9 - 3 .
Figure 9 - 3
According to the benchmarking functions, it took 0.07 seconds (give or take) to render the page, and it
used 0 memory. (It could also be showing zero because your copy of PHP didn ' t have - - enable - memory -
limit when it was compiled on the server. If that ' s the case, and you want to show this kind of data, you
c09.indd   291
c09.indd   291
6/10/08   5:38:06 PM
6/10/08   5:38:06 PM