php测试硬盘写入速度
用php写入一个1GB大小的文件,检查硬盘的写速率,可能有一定误差,一般电脑读写在20M/s,这个测试要执行大概40-50s。
例子,硬盘速度测试代码:
//测试硬盘写入速度
//by www.jbxue.com
set_time_limit(0);
$str = str_pad($str, 512, "0");
$file = fopen("./temp","a+");
$i = 0;
$bytes = 1000000000;
$mygabyte = $bytes/1000000;
echo "test start. waiting ...";
$starttime = time();
while($i < $bytes){
$i += fwrite($file, $str);
}
$endtime = time();
$usetime = $endtime - $starttime;
$write_xiaolv = $bytes/$usetime;
$myga_xiaolv = $mygabyte/$usetime;
echo "create 1GB file use time ".$usetime." seconds\n";
echo "speed :".$write_xiaolv." byte/s\n";
echo "speed :".$myga_xiaolv." m/s\n";
您可能感兴趣的文章:
php测试硬盘写入速度
hdparm工具参数详解
西部数据(WDC)硬盘官方检测工具 - Data Lifeguard Diagnostic
决定squid反向代理的性能要素
笔记本电脑速度慢时如何提速方法介绍
电脑越用运行越慢怎么回事?
电脑硬盘无法读写是坏了吗?硬盘无法读写原因?
PHP的Phar包原来性能这么强
bios能识别硬盘但系统识别不了解决方法
Win10磁盘100%占用空间不足怎么办