A few days ago I posted this question: measuring time of a profiled function
(I hope it's ok i'm opening a new thread, I just can't find the old one in the few first pages)
I noticed that in my profiled process, I call a "Sleep" method - and this is the problem...
When I call SuspendThread/ResumeThread - The Sleeping process pauses, but in reality - time moves on!
I figure that "Sleep" is just some kind of a loop that takes the time and stops whenever the difference between the start time and the end time is large enough.
well, suppose that your profiled process needs to sleep for 1 minute.
You suspended the profiled process after sleeping 2 seconds, and went to eat something.
You came back after 15 minutes and resumed the profiled process.
The profiled process measures the time, finds that MORE than 1 minute passed and it stops sleeping.
that's how I made the process sleep too little (time passes on, when the process is suspended, the Sleep takes it into account - but I can't!)...
And now, finally here is my question:
How can I avoid this problem? How can I measure the times of functions like "Sleep" properly?
thanks :)