krabsetw icon indicating copy to clipboard operation
krabsetw copied to clipboard

GetTraceDataProviders in provider.hpp has high CPU usage and takes 2-3 second to return?

Open rjadidi920 opened this issue 1 year ago • 0 comments

I noticed that during my function that creates krabs::providers and registers them, I get a high CPU usage which seemed odd.

I traced the problem to the following line of code in provider.hpp:

    template <typename T>
    provider<T>::provider(const std::wstring &providerName)
            ....
            hr = allProviders->GetTraceDataProviders(NULL);  // This line is causing high cpu usage and takes 2-3 seconds to return. tested in Windows 10 and Windows 7.

My question is, is there anyway to improve this? Because right now, for every provider that I want to create and register, it takes 2-3 second and high cpu usage because of this, so imagine when I try to register 10 providers..

I wanted to use the GUID version of the provider constructor, but the problem is I don't see it validating the GUID, because i might use providers that exist in some systems but don't exist in others, so I need to check if the GUID provider exist or not to begin with.

rjadidi920 avatar Jul 14 '24 04:07 rjadidi920