Timer function for debugging
Perfect, thats exactly what I am after, thanks.
For anyone who can make use of it, here is the ammended code:
class DebugTimer { uint StartTime; uint EndTime; bool running; public: bool Start() { if(!running) { StartTime = GetTickCount(); running = true; return(true); } return(false); } uint Stop() { if(running) { EndTime = GetTickCount(); running = false; return(EndTime-StartTime); } return(0); } };
I am trying to create a quick class for timing particular sequences of code (loops and nested functions) to determine where all my cpu cycles are going. So far I have come up with this:
The problem however is that the datetime variable along with any Timexxx() functions, their maximum resolution returned is seconds. For checking code timing you really need to be working in milliseconds. Is there any way anyone can think of doing this? Using the sleep function is of little use as it is running in the same thread (will pause everything and thus not achieve the desired results), and as far as I am aware there is no way to program multithreaded applications directly in mql5.