Public Shared Function GetCpuUsage() As Integer Dim myCount As Integer Using cpu = New PerformanceCounter() With cpu .CategoryName = "Processor" .CounterName = "% Processor Time" .InstanceName = "_Total" End With myCount = cpu.NextValue() System.Threading.Thread.Sleep(1000) myCount = cpu.NextValue() System.Threading.Thread.Sleep(1000) myCount = cpu.NextValue() End Using Return myCount End Function
System.Management
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)