-
performance counters
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
-
are you wanting something that runs in the background contantly and monitors ALL of the computer's cpu usage? I think that may be in the processThread class. I'll see what I can find. in the meatime, lookup processThread in the msdn with your visual basic
-
yeah, you could say that, some kinda program that only finds the processor usage information, using performance counters. I wasnt all 2 sure wat i was doing, the whole code might be wrong. but i have 2 use performance counters, so i cant use processthread. Thanks.