Results 1 to 3 of 3

Thread: performance counters

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Posts
    48

    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

  2. #2
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2004
    Posts
    48
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width