I'm trying to profile a function in another method, so in order to measure its time, I'm doing something like this:
double diffTime = GetCurrentTime() - m_lastTime;
SuspendOtherProcessThreads();
double runningTime += diffTime;
... Do profiling stuff ...
ResumeOtherProcessThreads();
m_lastTime = GetCurrentTime();
... Let profiled process run ....
This is what I do each sample and I consider the time in which I sampled to be "runningTime".
But for some reason I get that "runningTime" is much smaller than the actual running time.
This code runs tens of thousands times a second.
does anybody know what's wrong with it?
does it have something to do with the Suspend/ Resume things?
thanks :)