UtilProcessGetProcessPerformanceCounter(Process, String) Method
Gets a PerformanceCounter of the categry name "Process" with the specified counter name
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 PerformanceCounter GetProcessPerformanceCounter(
Process pr,
string counterName
)
Public Shared Function GetProcessPerformanceCounter (
pr As Process,
counterName As String
) As PerformanceCounter
Dim pr As Process
Dim counterName As String
Dim returnValue As PerformanceCounter
returnValue = UtilProcess.GetProcessPerformanceCounter(pr,
counterName)
public:
static PerformanceCounter^ GetProcessPerformanceCounter(
Process^ pr,
String^ counterName
)
static member GetProcessPerformanceCounter :
pr : Process *
counterName : string -> PerformanceCounter
No code example is currently available or this language may not be supported.
- pr Process
-
The process.
- counterName String
-
The name of the counter to get (eg. "% Processor Time").
PerformanceCounter
The resulting
PerformanceCounter.
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 perfCounter As PerformanceCounter = GetProcessPerformanceCounter(pr, "% Processor Time")
Dim sample1 As CounterSample = perfCounter.NextSample()
Thread.Sleep(1000)
Dim sample2 As CounterSample = perfCounter.NextSample()
Dim calc As Single = CounterSample.Calculate(sample1, sample2)
Dim cpuAverage As Single = (calc / Environment.ProcessorCount)
Console.WriteLine("Average CPU usage percentage for current process: {0:F2}%", cpuAverage)
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.