<Object> = pstats(<application name>, <time interval>)
<Object>.start()
<Object>.stop()
This process when run gathers the Memory usage and CPU utilization of all the processes of a particular application at specific time interval.
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.
Refer: http://webcvs.freedesktop.org/ldtp/ldtp/python/ldtputils.py
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()
This functionality depends on the pystatgrab (http://www.i-scream.org/pystatgrab/) package. Make sure you have it installed before using this memory and CPU utilization gathering function in your ldtp test scripts.
- Author:
- Subodh Soni <subodhsoni@gmail.com>
Linux Desktop Testing Project