Craig

Craig

  • NA
  • 1
  • 0

Help with my Process Viewer

Feb 11 2010 9:13 AM
hi, im trying to show the % of the cpu that is being used With A persific process. i have found out how to do it but it dubbles what it really is. also if i do Total it shows "200" i see that it is going form the Task-manager and totaling it all up any help please? hear is my code for example if i tell it to show how much CPU usage is being used by "firefox" in task-manager is shows 4 and in my program it shows 8
 Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PerformanceCounter1.CategoryName = "Process"
PerformanceCounter1.CounterName = "% Processor Time"
PerformanceCounter1.InstanceName = (ListBox1.SelectedItem)


End Sub



Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim pList() As System.Diagnostics.Process = _
System.Diagnostics.Process.GetProcesses
For Each proc As System.Diagnostics.Process In pList
ListBox1.Items.Add(proc.ProcessName)
Next
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'ListBox1.
End Sub


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
NumericUpDown1.Value = (CInt(PerformanceCounter1.NextValue))

TextBox1.Text = NumericUpDown1.Value
Label1.Text = PerformanceCounter1.InstanceName
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class