<?php
/***************************************************************
* (c) 2006-2007 Askywhale (hosting[a]askywhale.com)
* All rights reserved
*
* This script is part of HostingBenchmark.com. This project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
***************************************************************/
define('PROCESSORTEST_BASE_ITERATIONS',1000);
function bigRec($n) {
if($n<=2)
return $n+1;
return (bigRec($n-1)/(bigRec($n-2)));
}
class ProcessorTest extends AbstractTest {
function getTitle(){ return "CPU Test"; }
function getDescription(){ return "Will evaluate the general capacity of the main CPU"; }
function getDefaultOn(){ return true; }
function isBenchmark(){ return true; }
function doTest(){
$n = 0;
for($i=0;$i<300*PROCESSORTEST_BASE_ITERATIONS;$i++) {
$n*=$i;
$n%=(1<<31);
}
for($i=1;$i<400*PROCESSORTEST_BASE_ITERATIONS;$i++) {
$n=($n+100)/$i;
}
for($i=0;$i<75*PROCESSORTEST_BASE_ITERATIONS;$i++) {
$n+=log(pow(sin($i),0.1));
$n%=(1<<31);
}
$max = floor(log10(PROCESSORTEST_BASE_ITERATIONS)*8);
for($i=0;$i<$max;$i++) {
$n+=bigRec($i);
}
for($i=0;$i<30*PROCESSORTEST_BASE_ITERATIONS;$i++) {
$n=md5($n);
}
}
}
?>