This article is a mirror article of machine translation, please click here to jump to the original article.

View: 46488|Reply: 1

[Source] .NET/C# to get the CPU and memory usage of the specified process

[Copy link]
Posted on 2021-1-18 17:03:01 | | | |
Requirements: Instant visibility into the running status of the program.

The first is to obtain a specific process object, you can use the Process.GetProcesses() method to get all the processes running in the system, or the Process.GetCurrentProcess() method to get the process object corresponding to the current program. When you have a process object, you can create a PerformanceCounter type object by the process object name, and set the parameters of the PerformanceCounter constructor to obtain the CPU and memory usage of a specific process.



The code is as follows:


Tourists, if you want to see the hidden content of this post, pleaseReply






Previous:.NET/C# on to allow remote desktop access
Next:.NET Core in Linux traffic capture
 Landlord| Posted on 2021-1-25 16:59:26 |
View app status and statistics ASP.NET Core
https://www.itsvse.com/thread-9536-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com