dotnet-dump ——
阿新 • • 發佈:2021-01-12
原文:
使用dotnet-dump 查詢 .net core 3.0 佔用CPU 100%的原因
Introducing diagnostics improvements in .NET Core 3.0
這篇文章介紹了3個工具
- dotnet-counters: 實時統計runtime的狀況, 包括 CPU、記憶體、GC、異常等
- dotnet-trace: 類似效能探測器
- dotnet-dump: 程式崩潰時使用該工具
這次使用的是dotnet-dump, 即使程式沒有崩潰, 也可以dump程式快照, 用於分析
1. 新建一個簡單Console程式(只能是 .net core 3.0的程式, 不支援 .net core 2.2
2. 安裝dotnet-dump
dotnet tool install --global dotnet-dump --version 1.0.4-preview6.19311.1
提示
If you are using bash, you can add it to your profile by running the following command: cat << \EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:/home/****/.dotnet/tools" EOF You can add it to the current session by running the following command: export PATH="$PATH:/home/****/.dotnet/tools" You can invoke the tool using the following command: dotnet-dump Tool 'dotnet-dump' (version '1.0.4-preview6.19311.1') was successfully installed.
建議將 $HOME/.dotnet/tools加入到PATH, 好吧, 照著做吧, 記得使用下面的命令使設定立即生效
source ~/.bash_profile