萬盛學電腦網

 萬盛學電腦網 >> 電腦基本常識 >> 怎麼測試硬盤寫速率?分析一下php測試硬盤寫速率

怎麼測試硬盤寫速率?分析一下php測試硬盤寫速率

class="area"> 怎麼測試硬盤寫速率?分析一下php測試硬盤寫速率,今天電腦知識吧的小編,具體如下,

一般電腦讀寫在20M/s,這個測試要執行大概40-50s

<?php

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";

copyright © 萬盛學電腦網 all rights reserved