1.procdump 安装
1). rpm -Uvh
rpm -Uvh
https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
2)yum install procdump
也可以参考 https://gitee.com/mirrors/ProcDump-for-Linux
2.高cpu
//进程7569 cpu 大于1% 时间1秒 抓取3个dump
# sudo procdump -c 1 -n 3 -s 1 7569
sudo procdump -c 1 -n 3 -s 1 -p 7569
ProcDump v1.4 - Sysinternals process dump utility
Copyright (C) 2022 Microsoft Corporation. All rights reserved. Licensed under the MIT license.
Mark Russinovich, Mario Hewardt, John Salem, Javid Habibi
Sysinternals - www.sysinternals.com
Monitors one or more processes and writes a core dump file when the processes exceeds the
specified criteria.
[21:57:55 - INFO]: Press Ctrl-C to end monitoring without terminating the process(es).
Process: dotnet (7569)
CPU Threshold: >= 1%
Commit Threshold: n/a
Thread Threshold: n/a
File Descriptor Threshold: n/a
Signal: n/a
Exception monitor Off
Polling Interval (ms): 1000
Threshold (s): 1
Number of Dumps: 3
Output directory: .
[21:57:55 - INFO]: Starting monitor for process dotnet (7569)
[21:57:56 - INFO]: Trigger: CPU usage:149% on process ID: 7569
[21:57:57 - INFO]: Core dump 0 generated: ./dotnet_cpu_2023-03-02_21:57:56.7569
[21:57:59 - INFO]: Trigger: CPU usage:150% on process ID: 7569
[21:58:01 - INFO]: Core dump 1 generated: ./dotnet_cpu_2023-03-02_21:57:59.7569
[21:58:03 - INFO]: Trigger: CPU usage:149% on process ID: 7569
[21:58:04 - INFO]: Core dump 2 generated: ./dotnet_cpu_2023-03-02_21:58:03.7569
[21:58:04 - INFO]: Stopping monitor for process dotnet (7569)
3.高内存
//进程7569 内存 大于300MB 时间1秒 抓取3个dump
# sudo procdump -m 300 -s 1 27391
ProcDump v1.4 - Sysinternals process dump utility
Copyright (C) 2022 Microsoft Corporation. All rights reserved. Licensed under the MIT license.
Mark Russinovich, Mario Hewardt, John Salem, Javid Habibi
Sysinternals - www.sysinternals.com
Monitors one or more processes and writes a core dump file when the processes exceeds the
specified criteria.
[22:07:05 - INFO]: Press Ctrl-C to end monitoring without terminating the process(es).
Process: dotnet (27391)
CPU Threshold: n/a
Commit Threshold: >=300 MB
Thread Threshold: n/a
File Descriptor Threshold: n/a
Signal: n/a
Exception monitor Off
Polling Interval (ms): 1000
Threshold (s): 1
Number of Dumps: 1
Output directory: .
[22:07:05 - INFO]: Starting monitor for process dotnet (27391)
[21:57:56 - INFO]: Trigger: CPU usage:149% on process ID: 7569
[21:57:57 - INFO]: Core dump 0 generated: ./dotnet_cpu_2023-03-02_21:57:56.7569
[21:57:59 - INFO]: Trigger: CPU usage:150% on process ID: 7569
[21:58:01 - INFO]: Core dump 1 generated: ./dotnet_cpu_2023-03-02_21:57:59.7569
[21:58:03 - INFO]: Trigger: CPU usage:149% on process ID: 7569
[21:58:04 - INFO]: Core dump 2 generated: ./dotnet_cpu_2023-03-02_21:58:03.7569
[21:58:04 - INFO]: Stopping monitor for process dotnet (7569)