UtilProcessGetProcessCpuPercentUsageAsync(Process) Method
Asynchronously gets the CPU percentage usage for the specified Process.
Namespace: DevCase.Core.Diagnostics.ProcessesAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static Task<float> GetProcessCpuPercentUsageAsync(
Process pr
)
Public Shared Function GetProcessCpuPercentUsageAsync (
pr As Process
) As Task(Of Single)
Dim pr As Process
Dim returnValue As Task(Of Single)
returnValue = UtilProcess.GetProcessCpuPercentUsageAsync(pr)
public:
static Task<float>^ GetProcessCpuPercentUsageAsync(
Process^ pr
)
static member GetProcessCpuPercentUsageAsync :
pr : Process -> Task<float32>
No code example is currently available or this language may not be supported.
- pr Process
-
The Process.
TaskSingle
The resulting CPU percentage usage for the specified
Process.
Before calling this method, performance counters must be enabled in the 'app.config' file. See the next example:
<configuration>
...
<system.net>
<settings>
<performanceCounters enabled="true"/>
</settings>
</system.net>
...
</configuration>
This is a code example.
No code example is currently available or this language may not be supported.
Dim pr As Process = Process.GetCurrentProcess()
Dim cpuPercent As Single = Await GetProcessCpuPercentUsageAsync(pr)
Dim str As String = String.Format("Process Name: {0}; CPU Usage: {1:F2}%", pr.ProcessName, cpuPercent)
Console.WriteLine(str)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.