php检测服务器的运行
时间:2014-06-09 16:40来源: 作者: 点击:
次
//检测函数支持 function isfun( $funName ){ return (false!==function_exists( $funName ))? 支持 : fontcolor=red不支持/font ; } //整数运算能力测试 function test_int(){ $timeStart = gettimeofday (); for ( $i =0; $i 3000000; $i ++){ $t
-
- function isfun($funName) {
- return (false !== function_exists($funName))?'支持':'<font color=red>不支持</font>';
- }
-
- function test_int() {
- $timeStart = gettimeofday();
- for($i = 0; $i < 3000000; $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 < 3000000; $i++) {
-
- sqrt($t);
- }
- $timeEnd = gettimeofday();
- $time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"];
- $time = round($time, 3)."秒";
- return $time;
- }
-
- function test_io() {
- $fp = @fopen(PHPSELF, "r");
- $timeStart = gettimeofday();
- for($i = 0; $i < 10000; $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);
- }
(责任编辑:admin) |
------分隔线----------------------------