PerformanceCounter in Microsoft.Diagnostics vs Microsoft.Diagnostics.EventFlow

153 views Asked by At

I am planning to use PerformanceCounter for one of my project. I knew only about Microsoft.Diagnostics. However I stumbled upon a rather newer library Microsoft.Diagnostics.EventFlow under official Microsoft Azure project which seem to provide similar functionality.

I am unfamiliar with Azure services and its libraries, so apologies if these two libraries are completely orthogonal.

1

There are 1 answers

1
Peter Bons On BEST ANSWER

The EventFlow library uses the performance counter in the Microsoft.Diagnostics namespace as can be seen here. It does not provide any performance counters on its own.

The EventFlow library lets you capture the data for specific performance counters and output that data to one of the supported outputs. It is not designed to read the data directly, but to route it to another destination like application insights as stated at the introduction:

The EventFlow library suite allows applications to define what diagnostics data to collect, and where they should be outputted to

So, summarized: to directly read the values of the performance counters use the classes in the Microsoft.Diagnostics namespace. To log the values somewhere else use the EventFlow library.