Use php to test the hard disk write speed. Copy the code as follows :? Phpset_time_limit (0); $ strstr_pad ($ str, 512,0); $ filefopen (. temp, a +); $ i0; $ bytes1000000000; $ mygabyte $ bytes1000000; E
The code is as follows:
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 1 GB file use time". $ usetime. "seconds \ n ";
Echo "speed:". $ write_xiaolv. "byte/s \ n ";
Echo "speed:". $ myga_xiaolv. "m/s \ n ";
The http://www.bkjia.com/PHPjc/728111.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/728111.htmlTechArticle code is as follows :? Php set_time_limit (0); $ str = str_pad ($ str, 512, "0"); $ file = fopen (". /temp "," a + "); $ I = 0; $ bytes = 1000000000; $ mygabyte = $ bytes/1000000; echo" test...