Performance counters in C ++ without lodctr

I'm kinda used to how C # applications can create performance counters - just by instantiating a new object PerformanceCounterand using it.

Now I am forced to use unmanaged C (C ++?), And I am really unhappy with the simplicity of using the API and the provided samples. My main pain is the need to use lodctr to load the manifest, as said on MSDN . I could not find a solution for this. Is there a way to use performance counters without explicitly loading the manifest, how can I do in C #?

+2
source share
1 answer

PDH (Performance Data handler).

// During startup call
h = PdhOpenQuery()
for each counter
   PdhAddCounter( h ... )

// When you want the data values call
PdhCollectQueryData( h )
for each counter
   PdhGetFormattedCounterValue()
-1

Source: https://habr.com/ru/post/1678850/


All Articles