1 Adet Timer- 1 Adet Label- 1 Adet PerformanceCounter
Kod:
category name : işlemc
CounterName : %İşlemci Zamanı
İnstanceName: _Total
TİMER KOD :
ProgressBar1.Value = PerformanceCounter1.NextValue.ToString
Label3.Text = "CPU Usage: " + ProgressBar1.Value.ToString + "%"
FORM KOD :
Timer1.Start()
Forumda Araştıra Bilirdiniz.
Hocam buyrun bendeki kod bu ;
Public Class Form1
Private PerCounter As System.Diagnostics.PerformanceCounter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PerCounter = New System.Diagnostics.PerformanceCounter
PerCounter.CategoryName = "Processor"
PerCounter.CounterName = "% Processor Time"
PerCounter.InstanceName = "_Total"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim sanalyer As Double
sanalyer = (My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / 1048576 / 1024
Dim sanalyer1 As Long
sanalyer1 = My.Computer.Info.AvailablePhysicalMemory * 100
Dim mrt As Long
mrt = Val(sanalyer1 / My.Computer.Info.TotalPhysicalMemory)
ProgressBar2.Value = mrt
Label2.Text = "RAM: " & sanalyer.ToString("N") & " GB"
Dim i As Integer = Integer.Parse(Format(PerCounter.NextValue, "##0"))
ProgressBar1.Value = i
Label1.Text = "CPU: " & i & " %"
End Sub
End Class
Program zaten çalışıyor timerin intervaline göre düzenleniyor onda bir problem yok ben ortalama değeri yanına yazdırmak istiyorum ancak böyle bir kod bilmiyorum ?