Skip to main content

process-plot

codecov.io PyPI version

Create plots of resource usage for a process (memory, CPU, etc).

Process statistics are polled at a set interval, in a cross-platform manner (i.e. supports Linux, OSX and Windows).

Information is collected on both the main process and any child processes, and can be plotted in a single graph.

Usage

Install the package with pip or pipx:

$ pipx install process-plot

then run:

$ pplot exec "sleep 1" -i 0.1
PPLOT INFO: Output files will be written to: /user/pplot_out, with basename: 20210921125420
PPLOT INFO: Running process as PID: 5379
PPLOT INFO: Total run time: 0 hour(s), 00 minute(s), 01.034680 second(s)
PPLOT INFO: Plotting results to: pplot_out/20210921125420.png
PPLOT SUCCESS!

You will then find the output files in /user/pplot_out, with a plot for the process like:

example plot

If the process spawns child processes, by default, the values for the main process and all child processes are summed together. When called with --stack-processes, the plot will stack the values per process:

$ pplot exec "parallel sleep ::: 2 2 2" -i 0.2 --stack-processes --legend

example parallel plot

Additional options are available:

$ pplot exec --help

 Usage: pplot exec [OPTIONS] COMMAND

 Execute a command and profile it.

╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    command      TEXT  [default: None] [required]                                                            │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --interval        -i                FLOAT               Polling interval (seconds) [default: 1]               │
│ --timeout         -t                FLOAT               Timeout process (seconds)                             │
│ --child               --no-child                        Collect child process data [default: child]           │
│ --command-output  -c                [hide|screen|file]  Mode for stdout/stderr of command [default: file]     │
│ --outfolder       -o                DIRECTORY           Folder path for output files [default: pplot_out]     │
│ --basename        -n                TEXT                Basename for output files (defaults to datetime)      │
│ --quiet           -q                                    Quiet mode                                            │
│ --help            -h                                    Show this message and exit.                           │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Plot ────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --plot-cols        -p                           COMMA-DELIMITED  Columns to plot                              │
│                                                                  [default: memory_rss, cpu_percent]           │
│ --stack-processes       --no-stack-processes                     Stack values per process in plot             │
│                                                                  [default: no-stack-processes]                │
│ --title                                         TEXT             Plot title (defaults to command)             │
│ --grid                  --no-grid                                Add grid to plots [default: grid]            │
│ --legend                --no-legend                              Add legend to figure [default: no-legend]    │
│ --size-width       -sw                          FLOAT            Width of plot in cm [default: None]          │
│ --size-height      -sh                          FLOAT            Height of plot in cm [default: None]         │
│ --format           -f                           [png|pdf|svg]    Plot file format [default: png]              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Acknowledgements

Initially adapted from: https://github.com/jeetsukumaran/Syrupy

Metadata

Release files for process_plot 0.5.2

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

Source distribution (sdist)

Source distribution for process_plot 0.5.2
File Size Uploaded
process_plot-0.5.2.tar.gz 76.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for process_plot 0.5.2
File Interpreter ABI Platform
process_plot-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 86.6 kB

Release files / process_plot-0.5.2.tar.gz

Download URL process_plot-0.5.2.tar.gz
Size 76.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ea1921f776d92f47b66add67590948e8883c0b7a723f84f21c14a138251fcacb
BLAKE2b-256 checksum
How to use checksums
087ecd1bfca12dae3419f2784741ee73eca0feafeb3519bba588d054a7c62b6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / process_plot-0.5.2-py3-none-any.whl

Download URL process_plot-0.5.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5be81c2f99726731f08a0e4dd3bbe1ab683bb58db0dc6068fc4b77f3978306d4
BLAKE2b-256 checksum
How to use checksums
8211aa51682f77072b6a8c51c900c9e5fce8659c5fb2896130b56310b65850e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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