赞
踩
'检测指定进程的CPU和内存占用情况
'vs2019 vb.net
Dim Name = Process.GetCurrentProcess().ProcessName
Dim cpuCounter = New PerformanceCounter("Process", "% Processor Time", Name)
Dim ramCounter = New PerformanceCounter("Process", "Working Set", Name)
Dim cpu = cpuCounter.NextValue().ToString("p1")
Dim ram = (ramCounter.NextValue() / 1024 / 1024 / 2).ToString("f1")
Debug.WriteLine(Name & ", " & cpu & ", " & ram)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。