process_plot


Nameprocess_plot JSON
Version 0.5.2 PyPI version JSON
download
home_pageNone
SummaryCreate plots of memory usage for a process.
upload_time2024-06-03 22:55:52
maintainerNone
docs_urlNone
authorChris Sewell
requires_python>=3.9
licenseNone
keywords memory profiling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # process-plot

[![codecov.io][cov-badge]][cov-link]
[![PyPI version][pypi-badge]][pypi-link]

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](https://pip.pypa.io) or [pipx](https://github.com/pypa/pipx):

```console
$ pipx install process-plot
```

then run:

```console
$ 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](example.png)

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:

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

![example parallel plot](example_parallel.png)

Additional options are available:

```console
$ 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>

[ci-badge]: https://github.com/chrisjsewell/process-plot/workflows/CI/badge.svg?branch=main
[ci-link]: https://github.com/chrisjsewell/process-plot/actions?query=workflow%3ACI+branch%3Amain+event%3Apush
[cov-badge]: https://codecov.io/gh/chrisjsewell/process-plot/branch/main/graph/badge.svg
[cov-link]: https://codecov.io/gh/chrisjsewell/process-plot
[pypi-badge]: https://img.shields.io/pypi/v/process-plot.svg
[pypi-link]: https://pypi.org/project/process-plot

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "process_plot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "memory, profiling",
    "author": "Chris Sewell",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/08/7e/cd1bfca12dae3419f2784741ee73eca0feafeb3519bba588d054a7c62b6c/process_plot-0.5.2.tar.gz",
    "platform": null,
    "description": "# process-plot\n\n[![codecov.io][cov-badge]][cov-link]\n[![PyPI version][pypi-badge]][pypi-link]\n\nCreate plots of resource usage for a process (memory, CPU, etc).\n\nProcess statistics are polled at a set interval, in a cross-platform manner (i.e. supports Linux, OSX and Windows).\n\nInformation is collected on both the main process and any child processes, and can be plotted in a single graph.\n\n## Usage\n\nInstall the package with [pip](https://pip.pypa.io) or [pipx](https://github.com/pypa/pipx):\n\n```console\n$ pipx install process-plot\n```\n\nthen run:\n\n```console\n$ pplot exec \"sleep 1\" -i 0.1\nPPLOT INFO: Output files will be written to: /user/pplot_out, with basename: 20210921125420\nPPLOT INFO: Running process as PID: 5379\nPPLOT INFO: Total run time: 0 hour(s), 00 minute(s), 01.034680 second(s)\nPPLOT INFO: Plotting results to: pplot_out/20210921125420.png\nPPLOT SUCCESS!\n```\n\nYou will then find the output files in `/user/pplot_out`, with a plot for the process like:\n\n![example plot](example.png)\n\nIf the process spawns child processes, by default, the values for the main process and all child processes are summed together.\nWhen called with `--stack-processes`, the plot will stack the values per process:\n\n```console\n$ pplot exec \"parallel sleep ::: 2 2 2\" -i 0.2 --stack-processes --legend\n```\n\n![example parallel plot](example_parallel.png)\n\nAdditional options are available:\n\n```console\n$ pplot exec --help\n\n Usage: pplot exec [OPTIONS] COMMAND\n\n Execute a command and profile it.\n\n\u256d\u2500 Arguments \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 *    command      TEXT  [default: None] [required]                                                            \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --interval        -i                FLOAT               Polling interval (seconds) [default: 1]               \u2502\n\u2502 --timeout         -t                FLOAT               Timeout process (seconds)                             \u2502\n\u2502 --child               --no-child                        Collect child process data [default: child]           \u2502\n\u2502 --command-output  -c                [hide|screen|file]  Mode for stdout/stderr of command [default: file]     \u2502\n\u2502 --outfolder       -o                DIRECTORY           Folder path for output files [default: pplot_out]     \u2502\n\u2502 --basename        -n                TEXT                Basename for output files (defaults to datetime)      \u2502\n\u2502 --quiet           -q                                    Quiet mode                                            \u2502\n\u2502 --help            -h                                    Show this message and exit.                           \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Plot \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --plot-cols        -p                           COMMA-DELIMITED  Columns to plot                              \u2502\n\u2502                                                                  [default: memory_rss, cpu_percent]           \u2502\n\u2502 --stack-processes       --no-stack-processes                     Stack values per process in plot             \u2502\n\u2502                                                                  [default: no-stack-processes]                \u2502\n\u2502 --title                                         TEXT             Plot title (defaults to command)             \u2502\n\u2502 --grid                  --no-grid                                Add grid to plots [default: grid]            \u2502\n\u2502 --legend                --no-legend                              Add legend to figure [default: no-legend]    \u2502\n\u2502 --size-width       -sw                          FLOAT            Width of plot in cm [default: None]          \u2502\n\u2502 --size-height      -sh                          FLOAT            Height of plot in cm [default: None]         \u2502\n\u2502 --format           -f                           [png|pdf|svg]    Plot file format [default: png]              \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\n```\n\n## Acknowledgements\n\nInitially adapted from: <https://github.com/jeetsukumaran/Syrupy>\n\n[ci-badge]: https://github.com/chrisjsewell/process-plot/workflows/CI/badge.svg?branch=main\n[ci-link]: https://github.com/chrisjsewell/process-plot/actions?query=workflow%3ACI+branch%3Amain+event%3Apush\n[cov-badge]: https://codecov.io/gh/chrisjsewell/process-plot/branch/main/graph/badge.svg\n[cov-link]: https://codecov.io/gh/chrisjsewell/process-plot\n[pypi-badge]: https://img.shields.io/pypi/v/process-plot.svg\n[pypi-link]: https://pypi.org/project/process-plot\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Create plots of memory usage for a process.",
    "version": "0.5.2",
    "project_urls": {
        "Homepage": "https://github.com/chrisjsewell/process-plot"
    },
    "split_keywords": [
        "memory",
        " profiling"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8211aa51682f77072b6a8c51c900c9e5fce8659c5fb2896130b56310b65850e1",
                "md5": "b383798f7c91e7c6ffff145a0ab5a0a5",
                "sha256": "5be81c2f99726731f08a0e4dd3bbe1ab683bb58db0dc6068fc4b77f3978306d4"
            },
            "downloads": -1,
            "filename": "process_plot-0.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b383798f7c91e7c6ffff145a0ab5a0a5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 10202,
            "upload_time": "2024-06-03T22:55:50",
            "upload_time_iso_8601": "2024-06-03T22:55:50.558007Z",
            "url": "https://files.pythonhosted.org/packages/82/11/aa51682f77072b6a8c51c900c9e5fce8659c5fb2896130b56310b65850e1/process_plot-0.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "087ecd1bfca12dae3419f2784741ee73eca0feafeb3519bba588d054a7c62b6c",
                "md5": "ab966cbd0bc55dd42cea02e54c648275",
                "sha256": "ea1921f776d92f47b66add67590948e8883c0b7a723f84f21c14a138251fcacb"
            },
            "downloads": -1,
            "filename": "process_plot-0.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ab966cbd0bc55dd42cea02e54c648275",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 76357,
            "upload_time": "2024-06-03T22:55:52",
            "upload_time_iso_8601": "2024-06-03T22:55:52.422686Z",
            "url": "https://files.pythonhosted.org/packages/08/7e/cd1bfca12dae3419f2784741ee73eca0feafeb3519bba588d054a7c62b6c/process_plot-0.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-03 22:55:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "chrisjsewell",
    "github_project": "process-plot",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "process_plot"
}
        
Elapsed time: 0.25400s