No announcement yet.

How to monitor CPU and Mem usage?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to monitor CPU and Mem usage?

    Hi ,

    I want to monitor the CPU and Mem usage when running a software under PTS.

    Is there any variables I can use to do this thing?
    And how to use it? Similar to $TIMER_START and $TIMEE_STOP in the sample-program?


  • #2
    Hi Ava,

    Currently there is only memory and CPU monitoring support through a separate module that will chart out the results. i.e. run:

    MONITOR=all ./phoronix-test-suite benchmark encode-ogg

    To see all monitor results. Though some of the monitoring capabilities are only supported on Linux, but patches for OpenSolaris would be welcome.

    Then I can add support so that a test profile can monitor the CPU usage within a test profile using say $CPU_LOAD_AVG_START $CPU_LOAD_AVG_END or something like that along with other metrics. I'll see about writing up that support this week

    Let me know if you have any other questions or requests.

    Michael Larabel


    • #3

      I just committed something to Git master that I hope is able to fulfill your needs:

      Test profiles can now call $SYSTEM_MONITOR_START and $SYSTEM_MONITOR_STOP. Below is a brief example of one I hacked together to demonstrate for an install script for a test profile:

      echo "#!/bin/sh
      \$SYSTEM_MONITOR_START mem.usage delta 1
      firefox &
      \$TIMED_KILL firefox 10
      sleep 8
      \$SYSTEM_MONITOR_STOP > \$LOG_FILE" > idle
      chmod +x idle
      What that does is monitor the memory usage every 1 second while launching Firefox for 10 seconds. The memory usage delta/difference is then determined.

      $SYSTEM_MONITOR_START has three parameters. The first is what to monitor (currently what's implemented right now is mem.usage or cpu.usage). The second argument is for average, maximum, minimum, delta, or all. The last argument is the amount of time (in seconds) between polling results.

      Running $SYSTEM_MONITOR_STOP then stops the polling and will return the value.


      Let me know how that works out for your needs or if you hit any problems or need any other features Patches are also welcome along with new test profiles.

      Michael Larabel


      • #4
        Support has now been committed to pts-core/ so that OpenSolaris has integrated CPU load usage detection as well.
        Michael Larabel