Syntax

<Object> = pstats(<application name>, <time interval>)

<Object>.start()

<Object>.stop()

Description

This process when run gathers the Memory usage and CPU utilization of all the processes of a particular application at specific time interval.

Implementation

When this functionality is to be used in a python test script you need to create a new object for pstats class.

The arguments passed while instantiating this class are Application name and Time interval.

As soon as the <Object>.start() method is called in the test script, memory usage and CPU utilization of the application start getting logged into the ldtp log file.

When <Object>.stop is called the thread gathering the information stops.

Examples

If I want the resource usage of all processes related to evolution to be logged every 2 seconds, the following statements need to be incorporated in the test script

xstats = pstats('evolution', 2)

xstats.start()

<Test Script>

xstats.stop()

Dependency

This functionality depends on the pystatgrab package. Make sure you have it installed before using this memory and CPU utilization gathering function in your ldtp test scripts.

Reference

How to get statistics of CPU / Memory

Class pstats (last edited 2007-12-19 20:13:04 by NagappanAlagappan)