in reply to My Program Stats

Can I ask what your purpose for this is?

You mention "average stats", but if, for example, your purpose is capacity planning, then averages are a poor measure. If the average usage for a process is say 2GB, you might consider that provisioning servers or VMs with 4GB is sufficient, but that might mask the fact that for some brief period, it required 5GB with the inevitable consequences.

For the Windows platform, there are a whole bunch of performance monitoring counters and 2 or 3 different ways of accessing them that can provide CPU and memory usage statistics on a per process basis. They can provide instantaneous, average and lifetime peak stats. Of course, that doesn't help you on other platforms, but this type of thing will always need platform specific solutions.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: My Program Stats
by gulden (Monk) on Jun 16, 2011 at 17:28 UTC

    From what you said i can do:

    1. Launch MyWrapper (my_wrapper.pl)
    2. In MyWrapper: launch MyProgram (my_program.pl) using for instance Proc::Background.
    3. In MyWrapper: collect stats from Win32PerfCounters during or at the end of the execution of MyProgram

    This seems to me a valid solution for Win32.

      You might find Corion's DBD::WMI a suitable way of accessing the required information.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.