Essential System Utils

psrecord – record the CPU and memory activity of a process

psrecord is a command-line utility for recording the CPU and memory consumption of a running process. It uses the Python psutil library to collect measurements at regular intervals, helping users understand how an application’s resource usage changes over time.

The software is particularly useful when investigating processes that gradually consume more memory, exhibit occasional spikes or behave differently under sustained workloads. Unlike tools that provide only a snapshot of current resource consumption, psrecord can create a record that can be examined after the monitored process has finished.

It can also launch a program and monitor its execution, making it useful for comparing workloads and capturing resource consumption during testing.

This is free and open source software.

Key Features

  • Attach to an existing process using its PID or launch a command and monitor it from the beginning.
  • Record CPU utilisation together with resident and virtual memory consumption.
  • Save measurements as a plain-text log or CSV file for subsequent analysis.
  • Generate plots of CPU and memory activity using Matplotlib, including on headless Linux systems.
  • Configure the sampling interval and specify a maximum monitoring duration.
  • Include child processes in the recorded statistics, allowing workloads that spawn additional processes to be monitored together.
  • Optionally collect disk I/O statistics, including read and write operation counts and transferred bytes.
  • Display measurements on standard output when neither a log file nor a plot is requested.

Website: github.com/astrofrog/psrecord
Support:
Developer: Thomas P. Robitaille
License: BSD 2-Clause ‘Simplified’ License

Options for psrecord

psrecord is written in Python. Learn Python with our recommended free books and free tutorials.


Related Software

Process Memory Tools
ps_memAccurately reports memory usage of programs
pscircleVisualizes Linux processes in a form of radial tree
psrecordRecord the CPU and memory activity of a process
smem2Reports on memory usage on Linux systems
process-memDisplay memory used by processes
process-mapVisualize the virtual memory of a process
SmemstatReports the physical memory usage
mstatMeasure memory usage of a program over time
alramHelps when available memory is below threshold, with optional task killer

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted