Dear Monks,

I'm looking to assess CPU usage on a Windows 2000 machine. Basically, I have a Perl program that is on a group of networked machines. This program is designed to run in the background on each of the machines. I want the sleep time within the  For (1..200) {  #some code here;  sleep 20;  } arrangement to be determined by the level of CPU usage. The greater the level of CPU usage the greater the sleep time within the loop.

In particular what modules would people recommend?

Update:
It looks like Win32::Process::Info is the module to go for. From different nodes that I have read it has become apparent that there is a wide range of information that can be returned with use of this module. I am very keen to automate the assessment of CPU usage in order that the level of CPU usage (over a period of about 2 minutes) within a PC node can determine the availability of this node (within a distributed computer network). Can anyone please suggest what info I need to return using Win32::Process::Info in order to do this.


Update B:

I need to take another look at: Win32-Process-Memory

In reply to CPU usage Windows OP by Win

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.