Jump to content

CPU load in windows for a period of time

- - - - -

  • Please log in to reply
1 reply to this topic

#1
asshaikh432

asshaikh432

    Newbie

  • Members
  • Pip
  • 1 posts
Hello there,
I am looking to monitor my cpu load for a time period say 1 minute, throughout the time period i want to check if the cpu load has not exceeded 80% for the ENTIRE period, to ensure there is no random spike. Is there an existing function which has similar functionality to this?

i have found a wmi call which grabs the cpu load but this just gets a snapshot and it does not monitor the cpu load for a durational period.

I could write something which grabs the cpu value fora given time period but this would be very resource intensive
any suggestions to this problem?

any help you can give would greatly be appreciated
many thanks

#2
zoranh

zoranh

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 207 posts
As far as I know, there is no way to get integral of CPU usage for a period of time except that you make sample and then sum/average them.

Easiest way to get system performance metrics from .NET is to read Performance Counters. That method does not spend too much resources. Here is code example which reads CPU usage. You can use perfmon.exe to find out which counters are registered.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users