Hide personal files within other files
  • Login
  • Become a blogger
  • PHP Performance Benchmark Script

    Posted by thinkdj on December 28th, 2007
    1 Comment | 3,323 pageviews
    /*
    
    PHP Performance Benchmark Script
    
    Copyright 2003 : PHP Consulting
    
    There are two settings:
    
    First, set $file to be the server and page that you want to benchmark.
    
    Secondly, set $iter to be the number of times you want it loaded.
    
    */
    
    
    error_reporting(E_ALL ^ E_NOTICE); //For disabling non fatal error outputs
    
    $file = "http://127.0.0.1/Joomla/index.php"; //Location to file
    
    $iter = 5; //No of times to check
    
    function getmtime()
    
    {
    
    $a = explode (' ',microtime());
    
    return(double) $a[0] + $a[1];
    
    }
    
    for ($i = 0; $i < $iter; $i++)
    
    {
    
    $start = getmtime();
    
    file ($file);
    
    $loadtime += getmtime() - $start ;
    
    $intertime = getmtime() - $start ;
    
    echo $intertime . "<br>" ;
    
    $avgload = $loadtime / $iter;
    
    }
    
    echo "<p><b>Average" . $avgload . "</b>" ;
    
    ?>

    1 Response »

    Trackbacks/Pingbacks

    1. php says:

      [...] PHP Performance Benchmark Script saved by 7 others… IrkenTrad bookmarked on 12/27/07 | [...]

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    More from "PHP"

    Find what you are looking for

    Recently added

    Categories

    Blogulate

    Keeping you updated of the latest fads and developments of the industry via amalgamated web content.

    Join us

    Post articles on blogulate and monetize them. Learn more »

    Stay updated

    Subscribe now and stay aware of the latest trends and happenings on the www. Get notified via email when we update.

    Enter your email address:

    Blogulate is based on Magnus premium theme by WizeDesigns
    © 2009 Blogulate. Some rights reserved.