Page 1 of 1

What is a sample code for execution measure in ms ?

Posted: Mon Jan 18, 2021 8:38 pm
by liveme
Hi,
Looking for some code on :
How to measure start time/ end time difference in mili or micro seconds...
Query exec time measure or simular purpose ?
Couldnt locate any syntax about that still...
Thanks

Re: What is a sample code for execution measure in ms ?

Posted: Mon Jan 18, 2021 9:17 pm
by FourthWorld

Re: What is a sample code for execution measure in ms ?

Posted: Mon Jan 18, 2021 10:34 pm
by dunbarx
Hi.

Go here and read it all. It is an undocumented feature.

http://forums.livecode.com/viewtopic.ph ... croseconds

Craig

Re: What is a sample code for execution measure in ms ? [SOLVED]

Posted: Tue Jan 19, 2021 12:20 am
by liveme
Thanks guys...nice info abuot benchmarking ! Great
Very helpfull, I could come up with some simple code...

Code: Select all

local KronoStart
on dostartkrono
   put the milliseconds into KronoStart
   put "Chrono is ON" into field KronoTime
end dostartkrono

local KronoEnd
on doendkrono
   put the milliseconds into KronoEnd
   put (KronoEnd - KronoStart)&" ms" into field KronoTime
end doendkrono
:wink:

Re: What is a sample code for execution measure in ms ?

Posted: Tue Jan 19, 2021 12:57 am
by FourthWorld
As I discussed in the article, for durations that short you'll want to get the average of many iterations.

Re: What is a sample code for execution measure in ms ?

Posted: Tue Jan 19, 2021 3:24 pm
by dunbarx
Hi.

So you are satisfied with milliseconds only? This is a standard function in LC, like the "ticks" or the "seconds". I thought you were interested in microSeconds.

Note that if you do indeed go down to that level, Richard's comment about taking running averages is even more important, since the machine running such timing gadgetry has a timing mind of its own. :wink:

Craig

Re: What is a sample code for execution measure in ms ?

Posted: Wed Jan 20, 2021 6:53 pm
by jacque
If you really want precision there is also "the long milliseconds" but you'll probably want an even larger pool of averages.