Мониторинг загрузки HDD - VB
Формулировка задачи:
Всем привет!
Нашел массу примеров о монгиторинге ресурсов (RAM/CPU...) Но увы ничего не нашел по анализу загрузки HDD. Никто не иммеет в своем архиве ничего подобного?
Решение задачи: «Мониторинг загрузки HDD»
textual
Листинг программы
Public Class ... Private HddLedWrite As System.Diagnostics.PerformanceCounter Private HddLedRead As System.Diagnostics.PerformanceCounter Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load HddLedRead = New System.Diagnostics.PerformanceCounter HddLedRead.CategoryName = "PhysicalDisk" HddLedRead.CounterName = "Disk Read Bytes/sec" HddLedRead.InstanceName = "_Total" HddLedWrite = New System.Diagnostics.PerformanceCounter HddLedWrite.CategoryName = "PhysicalDisk" HddLedWrite.CounterName = "Disk Write Bytes/sec" HddLedWrite.InstanceName = "_Total" End Sub Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick Dim I As Integer Dim Item As Object Dim DrivesInfo() As IO.DriveInfo Dim Read As Single = HddLedRead.NextValue Dim Write As Single = HddLedWrite.NextValue DrivesInfo = IO.DriveInfo.GetDrives() ReDim Drives(-1) For Each Item In DrivesInfo If Item.DriveType = IO.DriveType.Fixed Then I = Drives.Length ReDim Preserve Drives(I) Try With Drives(I) .Name = Item.Name.Replace("\", "") .LowSpace = Item.TotalFreeSpace / 1048576 < LowSpace .System = .Name = Environment.GetEnvironmentVariable("SystemDrive") .TotalFreeSpace = Item.TotalFreeSpace .TotalSize = Item.TotalSize .VolumeLabel = IIf(Len(Item.VolumeLabel) = 0, "Local Disk", Item.VolumeLabel) End With Catch ex As Exception 'Диск извлечен End Try End If Next Application.DoEvents() End Sub End Class
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д