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, please Reply
|