In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces to you what is the application method of VB.NET hard disk speed testing, the content is very detailed, interested friends can refer to, hope to be helpful to you.
What we are most interested in is the continuous read and write speed of the hard disk under the load. In order to measure the average speed more accurately, I decided to write a 1GB file and then read it out. In order not to let more tasks be spent on loops, I first set up a buffer large enough, and then wrote the contents of the buffer to the disk to make the hard drive reach the load. Considering the reading mechanism of Windows, the hard disk test is not accurate. The read part of this program can only be used in * runs. The more times the test is run, the inaccurate the test will be. However, the write test can still keep the accuracy after running many times. Let's do it now.
Create a console project TestHarddisk in VB.NET, and then write the following VB.NET hard disk speed test program 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 DateDate = 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 DateDate = 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 DateDate = Date.Now
Console.WriteLine ("Read Start at"
{0} ", StartRead)
Console.WriteLine ("Reading")
For I = 0 To Size Step bufSize
Bytes = fr.ReadBytes (bufSize)
Next
Dim EndRead As DateDate = 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
The relevant test method of VB.NET hard disk speed test is shown in the above code.
What is the application method of VB.NET hard disk speed testing is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.