跳转到主要内容

创建进程内存使用图表。

项目描述

process-plot

codecov.io PyPI version

创建进程资源使用图表(内存、CPU等)。

以跨平台的方式(即支持Linux、OSX和Windows)以预设间隔轮询进程统计信息。

收集有关主进程和任何子进程的信息,并可以绘制在单个图表中。

用法

使用pippipx安装软件包

$ pipx install process-plot

然后运行

$ 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!

您将在/user/pplot_out中找到输出文件,其中包含进程的图表,如下所示

example plot

如果进程生成子进程,默认情况下,主进程和所有子进程的值将相加。使用--stack-processes调用时,图表将按进程堆叠值

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

example parallel plot

其他选项

$ 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]              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

致谢

最初改编自: https://github.com/jeetsukumaran/Syrupy

项目详情


下载文件

下载您平台的文件。如果您不确定要选择哪个,请了解更多关于安装包的信息。

源分布

process_plot-0.5.2.tar.gz (76.4 kB 查看哈希值)

上传时间 源代码

构建分发版

process_plot-0.5.2-py3-none-any.whl (10.2 kB 查看哈希值)

上传时间 Python 3

支持者