Procpath
Procpath is a process tree analysis command-line workbench. Its goal is to provide natural interface to the tree structure of processes running on a Linux system for inspection, collection and later analysis with focus on performance.
Installation
pipx install Procpath
pipx is recommended for installing Procpath (into a dedicated virtual environment). Alternatively pip can be used to install Procpath to the Python user install directory.
pip install --user Procpath
Quickstart
Get comma-separated PIDs of the process subtree (including the parent process pid=2610).
procpath query -d , '$..children[?(@.stat.pid == 2610)]..pid'
Get JSON document of said process subtree.
procpath query -i 2 '$..children[?(@.stat.pid == 2610)]'
Get total RSS in MiB of said process subtree (this is an example that query produces JSON that can be further processed outside of procpath, and below is a much easier way to calculate aggregates).
procpath query '$..children[?(@.stat.pid == 2610)]' \
| jq '[.. | .stat? | objects | .rss] | add / 1024 * 4'
Get total RSS in MiB of said process subtree the easy way.
procpath query '$..children[?(@.stat.pid == 2610)]' \
'SELECT SUM(stat_rss) / 1024.0 * 4 total FROM record'
Get total RSS in MiB of a docker-compose stack.
L=$(docker ps -f status=running -f name='^project_name' -q | xargs -I{} -- \
docker inspect -f '{{.State.Pid}}' {} | tr '\n' ,)
procpath query "$..children[?(@.stat.pid in [$L])]" \
'SELECT SUM(stat_rss) / 1024.0 * 4 total FROM record'
Record process trees of two Docker containers once a second, re-evaluating the containers’ root process PIDs once per 30 recordings. Then visualise RSS of each process (which is also just an example, that output SQLite database can be visualised in different ways, including exporting CSV, sqlite3 -csv ..., and doing it the old way, to using proper UI described in the documentation).
procpath record \
-e C1='docker inspect -f "{{.State.Pid}}" project_db_1' \
-e C2='docker inspect -f "{{.State.Pid}}" project_app_1' \
-i 1 -v 30 -d out.sqlite '$..children[?(@.stat.pid in [$C1, $C2])]'
# press Ctrl + C
sqlite3 out.sqlite \
"SELECT stat_pid, group_concat(stat_rss / 1024.0 * 4) \
FROM record \
GROUP BY stat_pid" \
| sed -z 's/\n/\n\n\n/g' | sed 's/|/\n/' | sed 's/,/\n/g' > special_fmt
gnuplot -p -e \
"plot for [i=0:*] 'special_fmt' index i with lines title columnheader(1)"
Visualise the above recording the easy way.
procpath plot -d out.sqlite -o out.svg -q cpu -q rss
Metadata
Release files for Procpath 1.15.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| procpath-1.15.1.tar.gz | 80.6 kB | Without provenance | Details for procpath-1.15.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| procpath-1.15.1-py3-none-any.whl | Python 3 | none | any | Details for procpath-1.15.1-py3-none-any.whl |
Total release size: 168.4 kB
Release files / procpath-1.15.1.tar.gz
| Download URL | procpath-1.15.1.tar.gz |
|---|---|
| Size | 80.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
067e0ec7e422f59c3957858b9e47a12cd8965965016bc40bf6614d13fa453f14
|
|
BLAKE2b-256 checksum How to use checksums |
e440c40cbfa8b6ff62d34f281999b2bd9408ef704e9edee6f2d55646b1a81abb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / procpath-1.15.1-py3-none-any.whl
| Download URL | procpath-1.15.1-py3-none-any.whl |
|---|---|
| Size | 87.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d3b00b181a8937ad72b565d9f18aef9078c0361e965141271838819b5eca55a
|
|
BLAKE2b-256 checksum How to use checksums |
eba75cc14213573d339bce72e92e16479dccd9f785aea3dd66b5ea54355f82a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for Procpath 1.15.1
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.