Monthly Archives: September 2016

Using performance Counters

I like to use the memory and CPU counters while away from hardware equipment that we use to read gases and oxygen levels. They provide a real time input for testing and can be used very quickly, easily and the speed can be adjusted to whatever i need it to be.

to use place the following code as class variables in the form or what ever you need to call it.

Dim mem As New System.Diagnostics.PerformanceCounter("Memory", "Available MBytes")
Dim cpu As New System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", "_Total")

Then in the timer or calling function use this.

dim M as double = mem.NextValue()
dim C as double = cpu.NextValue()