<?
 
 
require "stopwatch.class.php";
 
 
$s = new Stopwatch();
 
 
$s->start("section1");
 
 
for ($i = 0; $i < 10000; $i++) {
 
  //Do nothing!
 
}
 
 
$s->stop("section1");
 
 
$s->start("section2");
 
 
 for ($i = 0;$i < 20000; $i++) {
 
    // Do nothing!
 
 }
 
 
 
$s->stop("section2");
 
 
 
$s->start("section3");
 
 
 for ($i = 0;$i < 30000; $i++) {
 
    // Do nothing!
 
 }
 
 
  $s->start("section3_nested");
 
 
 for ($i = 0;$i < 10000; $i++) {
 
    // Do nothing!
 
 }
 
 
 
$s->stop("section3_nested");
 
 
 
$s->stop("section3");
 
 
echo "Section 1 Duration: " . $s->getDuration("section1") . " seconds. \n";
 
 
echo "Section 2 Duration: " . $s->getDuration("section2") . " seconds. \n";
 
 
echo "Section 3 Duration: " . $s->getDuration("section3") . " seconds. \n";
 
 
echo "Section 3_nested (a subsection inside section 3): " . $s->getDuration("section3_nested") . " seconds. \n";
 
 
 
?>
 
 |