Test your hard drive speed with VB.NET

xiaoxiao2021-03-06  102

Test hard drive with VB.NET to post blog from HSC dream sky

The day before, suddenly I want to use Sisoftware Sandra 2004 to suddenly think, don't work with the VB.NET test of yourself with you? How do you do it?

What we are most interested is that the hard disk continues to read and write speeds under maximum load. In order to be more accurate measurement, I decided to use the first way to read a 1GB file again. Considering not to let more tasks spend on loops, I first build a sufficiently big buffer, then write this buffer content to the disk, so that the hard disk reaches the maximum load. Considering the reading mechanism of Windows, the hard disk test is less accurate. The reading section of this program can only be used in the first runtime. The more tests are not accurate, and the write test will remain after running multiple times. accuracy. I started to start now.

A console engineering TesthardDisk is created in VB.NET and then writes the following programs in Sub Main.

Sub

Main

()

DIM I as Int32

DIM F AS New FileStream ("E: /BIGFILE.BIG", FileMode.create)

DIM FW AS New BinaryWriter (f)

DIM fr as new binaryreader (f)

DIM SIZE AS INT32 = 1024 * 1024 * 1024 - 1 'File Size = 1GB

DIM BUFSIZE AS INT32 = 30 * 1024 * 1024 'Buffer Size = 30MB

DIM JLAST AS INT32 = BUFSIZE - 1

DIM J AS INT32

DIM BYTES (BUFSIZE) AS BYTE

Dim startwrite as date = date.now

Console.Writeline ("Write Start At {0}", StartWrite)

Console.writeline ("CREATING ...")

For i = 0 to size step bufsize '1GB

fw.write (bytes)

NEXT

DIM endwrite as date = date.now

DIM TimePassed As TimeSpan = endwrite.subtract (StartWrite)

Console.writeline ("Write End At {0}", ENDWRITE)

Console.writeline ("Time Passed: {0}", TimePassed)

Console.writeline ("Speed: {0}", 1000 / TimePassed.totalseconds)

fw.flush ()

DIM StartRead as date = Date.Now

Console.writeLine ("Read Start at {0}", StartRead)

Console.writeline ("Reading")

For i = 0 to size step bufsize

Bytes = fr.readbytes (buffsize)

NEXT

DIM endRead as date = date.now

TimePassed = endRead.subtract (StartRead)

Console.WriteLine ("Read end at {0}", endread)

Console.writeline ("Time Passed: {0}", TimePassed) Console.writeline ("Read Speed: {0}", 1000 / TimePassed.totalseconds)

Console.readline ()

Fw.close ()

End Sub

Test now.

Hardware Configuration:

Athlon 2500 (Running AT 1.8G)

EPOX 8RDA3 NFORCE2 motherboard

512DDR 400 (Running AT 400MHz)

ATA100 SEAGATE 7200.7 80GB 2MB

Software configuration:

Windows 2003 Server Standard Edition

Full newest WHQL driver

Visual Studio 2003, compiling Select RealSe mode to open all optimized options.

The first running test has a write speed of 43MB / s. The second measurement of 42MB / s, the third 41MB / s results 43Mb / s did not differ, and achieved the ideal effect. However, read tests will become transformed. The first 64MB / s, with Sissoftware test, with more than 5MB / s, the second time reached 1096MB / s, the third 1123MB / s, this is related to the Windows disk buffer mechanism, It seems that the role is still quite big, of course, it is recommended to read the test after restarting the computer.

Welcome to discuss with me, my homepage: http://wwsicong2004.vip.myrice.com

转载请注明原文地址:https://www.9cbs.com/read-126926.html

New Post(0)