Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Klesti Hoxha  >  K-Stopwatch  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: K-Stopwatch
Measure the time it takes to execute PHP scripts
Author: By
Last change: Uncommented an include line
Date: 4 years ago
Size: 884 bytes
 

Contents

Class file image Download
<?

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";


?>