官网地址(以此为准):dotnet-counters 诊断工具 - .NET CLI | Microsoft Docs
该工具主要用于监控当前项目的总体状态计数,如系统运行时、web站点请求状况等。
安装:dotnet tool install --global dotnet-counters 或在官网直接下载工具
命令:
1、dotnet-counters ps 查看服务器上运行中的Dotnet进程列表
2、dotnet-counters list 显示可用的计数器名称和说明(场景1和2都可以用这个查看说明)。
3、dotnet-counters collect 定期收集所选计数器的值,并将它们导出为指定的文件格式以进行后续处理。
4、dotnet-counters monitor 监控并显示所选计数器(dotnet-counters list可查看有哪些计数器可用)的定期刷新值。
场景一:dotnet-counters monitor -p 14660 --refresh-interval 1 监视id为14660的进程,每隔1秒钟刷新一次。
[System.Runtime]
% Time in GC since last GC (%) 0 #GC垃圾回收百分比
Allocation Rate (B / 1 sec) 73,440