Hi there, i'm tring to find the processor usage information, i.e. the CPU usage number u c in the task manager. I have the following code. i've used a timer control, so it can give me different values.
i'm a fairly new programmer, detailed answers will be highly appreciated. Thanks in advance.


Private Sub tmrDebug_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrDebug.Tick

Dim myPerformanceCounter1 As New PerformanceCounter("Processor", "% Processor Time", "_Total")
Dim myCounterSample1 As New CounterSample(10&, 20&, 30&, 40&, 50&, 60&, PerformanceCounterType.AverageCount64)

Console.WriteLine("RawValue = " & myCounterSample1.RawValue)

myCounterSample1 = myPerformanceCounter1.NextSample()

Console.WriteLine("RawValue = " & myCounterSample1.RawValue)

End Sub