User Tools

Site Tools


dictionary:more:begintiming

Begin Timing/End Timing

The begin timing verb is a debugging aid. It saves off the time the verb is run in milliseconds. Then using the End Timing verb to retrieve the number of milliseconds whatever scripting steps you placed in between the 2 took to run.

Note that this will not be exact as the calls to begin and end will add some small number of milliseconds of overhead, but it will still be very useful for discovering what parts of scripts might be taking extra long times.

Example:

begin timing

write log “do some scripting actions that you think might be slow”

set elapsedMilliseconds to end timing

write log “the scripting above took “ & elapsedMilliseconds & “ms to execute”

if you save the output to the value of a pseudo unit you can use that in an XTdb graph to see how the timing changes over time or when it is causing trouble.

begin timing
-- do long winded potentially problematic code here
set value of “pseudo to hold value” to end timing
dictionary/more/begintiming.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1