EA's speed: how to measure, as datetime down to seconds only

 

Hi,

How we measure accurately, things like:

- time spent on start() method

- time in between ticks

- time spent waiting for a tick (idle time)

The datetime gives down to the seconds only. The measurement unit must be lower than seconds like milliseconds.

Is GetTickCount() the only way?

Does GetTickCount() overflow to zero when the number becomes so high that the system's limit has been reached?

I am hoping for your comments.

Regards,

Jesus Angeles

 
jcadong5:

How we measure accurately, things like:

[...]

I am hoping for your comments.

It depends how accurate you want the figures to be. MT4's GetTickCount() function will give you a number in milliseconds, but it's not accurate to the millisecond. On all the hardware I've seen you get a number which is rounded to roughly the nearest 20ms. If you want more precise timings, you need to do something like importing QueryPerformanceCounter() and QueryPerformanceFrequency() from the Windows API.

 
jjc wrote >>

It depends how accurate you want the figures to be. MT4's GetTickCount() function will give you a number in milliseconds, but it's not accurate to the millisecond. On all the hardware I've seen you get a number which is effectively rounded to roughly the nearest 20ms. If you want more precise timings, you need to do something like importing QueryPerformanceCounter() and QueryPerformanceFrequency() from the Windows API.

Does GetTickCount() overflow to zero when the number becomes so high that the system's limit has been reached?

Are those methods you mentioned from Windows API going to need some Windows programming knowledge, for the MQL4 programmer to use them (like C language, etc.)? (I am a java developer but I hope you answer in general, for everybody here, as some may not know any other language other than MQL4, just like me who doesnt know anything on Windows programming.)

 
jcadong5:

Does GetTickCount() overflow to zero when the number becomes so high that the system's limit has been reached?

It wraps round to zero every 49.7 days. But effectively half that on MT4 if you store the result in a (signed) integer.


Are those methods you mentioned from Windows API going to need some Windows programming knowledge, for the MQL4 programmer to use them (like C language, etc.)?

Not really. I think there are plenty of people who've successfully worked with API calls in MT4 without having what you could reasonably call "Windows programming knowledge". The only minor challenge with QueryPerformanceCounter() and QueryPerformanceFrequency() is that they return 64-bit values.

Reason: