Skip to content

ExecutionTime

Inherits: LibTSMModule

Functions

CheckElapsed

lua
function Util.ExecutionTime.CheckElapsed(elapsedTime, labelFormatString, ...)

Checks the elapsed time and warns if it's too long.

Parameters:

NameTypeDescription
elapsedTimenumberThe elapsed time
labelFormatStringstringThe label format string to use for logging any warnings
...anyAdditional arguments for the label format string

WithMeasurement

lua
function Util.ExecutionTime.WithMeasurement(labelFormatString, ...)
  -> function, table, any

Returns an iterator which executes exactly once and measures the time taken within the loop body, warning if it's too long.

Parameters:

NameTypeDescription
labelFormatStringstringThe label format string to use for logging any warnings
...anyAdditional arguments for the label format string

Returns:

TypeDescription
function
table
any

WithMeasurementAndRaisedLogStackLevel

lua
function Util.ExecutionTime.WithMeasurementAndRaisedLogStackLevel(raiseStackLevel, labelFormatString, ...)
  -> function, table, any

Returns an iterator which executes exactly once and measures the time taken within the loop body, warning if it's too long.

Parameters:

NameTypeDescription
raiseStackLevelnumberThe amount to raise the stack level before logging
labelFormatStringstringThe label format string to use for logging any warnings
...anyAdditional arguments for the label format string

Returns:

TypeDescription
function
table
any