Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Python package to record activity from processes

Project Description


psrecord is a small utility that uses the psutil library to record the CPU and memory activity of a process. The package is still under development and is therefore experimental.

The code is released under a Simplified BSD License, which is given in the LICENSE file.


  • Python 2.7 or 3.3 and higher
  • psutil 1.0 or later
  • matplotlib (optional, used for plotting)


To install, simply do:

pip install psrecord



To record the CPU and memory activity of an existing process to a file:

psrecord 1330 --log activity.txt

where 1330 is an example of a process ID which you can find with ps or top. You can also use psrecord to start up a process by specifying the command in quotes:

psrecord "hyperion model.rtin model.rtout" --log activity.txt


To make a plot of the activity:

psrecord 1330 --plot plot.png

This will produce a plot such as:

You can combine these options to write the activity to a file and make a plot at the same time:

psrecord 1330 --log activity.txt --plot plot.png

Duration and intervals

By default, the monitoring will continue until the process is stopped. You can also specify a maximum duration in seconds:

psrecord 1330 --log activity.txt --duration 10

Finally, the process is polled as often as possible by default, but it is possible to set the time between samples in seconds:

psrecord 1330 --log activity.txt --interval 2


To include sub-processes in the CPU and memory stats, use:

psrecord 1330 --log activity.txt --include-children

Reporting issues

Please report any issues in the issue tracker.

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(55.2 kB) Copy SHA256 Hash SHA256
Source None Dec 5, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting