您好,欢迎访问一九零五行业门户网

php检测服务器的运行能力_PHP教程

php检测服务器的运行能力
// 检测函数支持
function isfun($funname) {
 return (false !== function_exists($funname))?'支持':'不支持';
}
//整数运算能力测试
function test_int() {
 $timestart = gettimeofday();
 for($i = 0; $i   $t = 1+1;
 }
 $timeend = gettimeofday();
 $time = ($timeend[usec]-$timestart[usec])/1000000+$timeend[sec]-$timestart[sec];
 $time = round($time, 3).秒;
 return $time;
}
//浮点运算能力测试
function test_float() {
 //得到圆周率值
 $t = pi();
 $timestart = gettimeofday();
 for($i = 0; $i   //开平方
  sqrt($t);
 }
 $timeend = gettimeofday();
 $time = ($timeend[usec]-$timestart[usec])/1000000+$timeend[sec]-$timestart[sec];
 $time = round($time, 3).秒;
 return $time;
}
//io能力测试
function test_io() {
 $fp = @fopen(phpself, r);
 $timestart = gettimeofday();
 for($i = 0; $i   @fread($fp, 10240);
  @rewind($fp);
 }
 $timeend = gettimeofday();
 @fclose($fp);
 $time = ($timeend[usec]-$timestart[usec])/1000000+$timeend[sec]-$timestart[sec];
 $time = round($time, 3).秒;
 return($time);
}
http://www.bkjia.com/phpjc/632010.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/632010.htmltecharticlephp检测服务器的运行能力 // 检测函数支持 function isfun($funname) { return (false !== function_exists($funname))?'支持':'font color=red不支持/font'; } //整数运...
其它类似信息

推荐信息