measuring time of a profiled function
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 tho开发者_如何学Pythonusands times a second.does anybody know what's wrong with it?
does it have something to do with the Suspend/ Resume things? thanks :)If your process is blocked by another process, your timing will be wrong.
Why are you not using a tool (like cachegrind to profile?
精彩评论