简体   繁体   English

对于使用 Windows、ZEDC9F0A5A5D577438888E3 和 macOS 的 .NET Core 3.1 的进程,如何测量 CPU 使用率和 memory?

[英]How to measure CPU usage and memory for a process using .NET Core 3.1 for Windows, Linux and macOS?

I want to get CPU and RAM utilization in Windows, Linux and macOS.我想在 Windows、Linux 和 macOS 中获得 CPU 和 RAM 利用率。 Also I need SQL Server(Sqlservr) process CPU and RAM utilization.我还需要 SQL 服务器(Sqlservr)进程 CPU 和 RAM 利用率。 I am trying this in ASP.NET Core 3.1 but not able to found any solution.我在 ASP.NET Core 3.1 中尝试这个,但找不到任何解决方案。 I am able to get dot net application CPU and RAM usage using the below command我可以使用以下命令获取 dot net 应用程序 CPU 和 RAM 使用情况

dotnet counters monitor --process-id 11812 --providers MyEventCounter

Refered link: https://www.stefangeiger.ch/2020/05/07/dotnet-diagnostics-tools-counters.html .参考链接: https://www.stefangeiger.ch/2020/05/07/dotnet-diagnostics-tools-counters.html Please suggest me the solution or any other technology to get this done.请向我建议解决方案或任何其他技术来完成这项工作。 Environment used: Windows 10, Visual Studio 2019 and .NET Core 3.1.使用的环境:Windows 10、Visual Studio 2019 和 .NET Core 3.1。

Use利用

dotnet-counters collect --process-id 1902 --refresh-interval 3 --format csv

Reference document https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters#examples参考文档https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters#examples

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM