PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Carl Taylor   profiler   example.php   Download  
File: example.php
Role: ???
Content type: text/plain
Description: Example usage
Class: profiler
Class to perform code profiling.
Author: By
Last change: Changed email addresses
Date: 22 years ago
Size: 1,921 bytes
 

Contents

Class file image Download
<html> <head> <title>Profiler Example</title> <LINK REL=STYLESHEET TYPE=text/css HREF=/profiler/basestyle.css> </head> <body> <?php include_once('./profiler.inc'); $prof = new Profiler( true ); // Output the profile information but no trace print("<h4>Scroll Down to see profiler output</h4>"); $prof->startTimer( "initialise" ); initialise_routine(); $prof->stopTimer( "initialise" ); $prof->startTimer( "main_loop" ); while( $record=get_record() ){ print_record( $record ); } $prof->stopTimer( "main_loop" ); print("<h4>The following is the profiler output</h4>"); $prof->printTimers( true ); print("<br><hr>Please let me know if you have any questions or suggestions for improvements.<a href=mailto:profiler@adepteo.net>profiler@adepteo.net</a><br>\n"); function initialise_routine() { $n=10000; while( $n-- ) ; } function get_record() { global $prof; static $count=10; if($count==0){ return; } $prof->startTimer( "get_record" ); for( $i=0; $i<10; $i++ ){ $rec[$i]="Record $count Field $i"; } $prof->stopTimer( "get_record" ); $count--; return( $rec ); } function print_record( $record ) { global $prof; // print header information print("Record Header Information<br>\n"); $prof->startTimer( "main_print_record" ); // main print processing foreach( $record as $key=>$val ){ print( "$key = $val<br>\n"); } $prof->stopTimer( "main_print_record" ); } ?>