Skip to main content

Create plots of memory usage for a process.

Project description

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

Project details


Download files

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

Source Distribution

process_plot-0.5.1.tar.gz (76.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

process_plot-0.5.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file process_plot-0.5.1.tar.gz.

File metadata

  • Download URL: process_plot-0.5.1.tar.gz
  • Upload date:
  • Size: 76.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for process_plot-0.5.1.tar.gz
Algorithm Hash digest
SHA256 98e4d1e08881a51227c20e62aa96f19e21158346ed3f27a9bcd8dba7319abde4
MD5 9f4b9a2033003730d63ff5c787d81672
BLAKE2b-256 81ba2a6f4b15a6abf66f483d15334178e170edac0d3c43bf65403384b91eedfe

See more details on using hashes here.

File details

Details for the file process_plot-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: process_plot-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for process_plot-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2651e0973bc73cc85c3f6bd2841720225436317487f0c4647b7f6b82e4387f2
MD5 f293f7ce4cba62067c76bfa38eaacbee
BLAKE2b-256 e98f9b7c7685e08b690f648454296f839fcb24cae67a0f0ac95076670c3c3f7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page