Skip to main content

Coverage Status

About

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.

Requirements

  • Python 3.10 and higher

  • psutil 5.6 or later

  • matplotlib (optional, used for plotting)

Installation

To install, simply do:

pip install psrecord

To install with the optional plotting dependencies, do:

pip install psrecord[plot]

Usage

Basics

To record the CPU and memory activity of an existing process to a file (use sudo for a root process):

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

Plotting

To make a plot of the activity:

psrecord 1330 --plot plot.png

This will produce a plot such as:

https://github.com/astrofrog/psrecord/raw/master/screenshot.png

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

Subprocesses

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

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

Running tests

To run tests, you will need pytest. You can install it with:

pip install pytest

You can then run the tests with:

pytest psrecord

Reporting issues

Please report any issues in the issue tracker.

Metadata

Release files for psrecord-io 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psrecord-io 1.5.0
File Size Uploaded Provenance Actions
psrecord_io-1.5.0.tar.gz 63.1 kB Without provenance Details for psrecord_io-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for psrecord-io 1.5.0
File Interpreter ABI Platform Actions
psrecord_io-1.5.0-py3-none-any.whl Python 3 none any Details for psrecord_io-1.5.0-py3-none-any.whl

Total release size: 75.0 kB

Release files / psrecord_io-1.5.0.tar.gz

Download URL psrecord_io-1.5.0.tar.gz
Size 63.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cc84a897b6dede17ebc755507f803e9e168a9675b929e01ea7a12b2d94e462ec
BLAKE2b-256 checksum
How to use checksums
f3307859ba086493ac0c9e4612dea87e7686df822c3462e47d2ed0ed7d96e01f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / psrecord_io-1.5.0-py3-none-any.whl

Download URL psrecord_io-1.5.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
917e7ce79f2f0ae674463459e5bde624fbd6fa0ad39f6daf16c24401199eff09
BLAKE2b-256 checksum
How to use checksums
6bec8f177eda7310eb67cd3cfb52e53ce8d269689d930a1a20c3a5ecdf6dcd5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for psrecord-io 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page