如何获得CPU使用率?

Mar*_*ark 5 vb.net

如何让cpu使用百分比显示在表单上的标签中?

cod*_*zen 20

Import Namespace System.Diagnostics

' ...
Dim cpu as New PerformanceCounter()
With cpu
    .CategoryName = "Processor"
    .CounterName = "% Processor Time"
    .InstanceName = "_Total"
End With

' ...
myLabel.Text = cpu.NextValue()
Run Code Online (Sandbox Code Playgroud)


Ger*_*nck 1

看这里:如何获取CPU使用率C#

应该很容易翻译成 VB.Net