PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of sanjeev   Speed Diagnostic   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: speed diagnodtic example
Class: Speed Diagnostic
Measure the speed of execution of a PHP script
Author: By
Last change:
Date: 15 years ago
Size: 549 bytes
 

Contents

Class file image Download
<?php
/**
 *@author sanjeev kumar<sanjeev.kushwaha@in.com>
 *
 */
include_once('speedDiagnostic.class.php');

 
$sTimer = new speedDiagnostic();
$sTimer->start('index');

function
wasteTime() {
   
$j = 2;
    for (
$i = 0; $i < 100; $i++) {
       
$j = $j * 10;
    }
    return;
}

function
myFunction() {
   global
$sTimer;
 
$sTimer->start('wasteTimefunction');
 
sleep(1);
   
wasteTime();
 
$sTimer->stop('wasteTimefunction');
    return;
}

myFunction();

$sTimer->stop('index');


//== display execution time
echo $sTimer->display();
?>