Refreshing a WMI Performance counter

Feb 20, 2006
Reaction score

How can i refresh a WMI Performance counter?

This is my code:

CComPtr< IEnumWbemClassObject > enumerator;

hr = service->ExecQuery( L"WQL", L"SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor, WBEM_FLAG_FORWARD_ONLY, NULL,enumerator );

ULONG retcnt;
CComPtr< IWbemClassObject > processor;
hr = enumerator->Next( WBEM_INFINITE, 1L, &processor, &retcnt );

now from the processor i can get "InterruptsPerSec" for example.

but if i want the average of it for an interval, i should sleep for an interval and after that refresh the performance counter to get the new value.

To refresh i need a IWbemRefresher. How can i get one from IWbemClassObject?

Thanks alot


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question