LuaProfiler

An object used to measure script performance.

Note: Since performance is non-deterministic these objects don't allow reading the raw time values from lua. They can be used anywhere a LocalisedString is used.
class LuaProfiler - sort
reset() Resets the clock, also restarting it.
stop() Stops the clock.
restart() Start the clock again, without resetting it.
add(other) Add the duration of another timer to this timer.
divide(number) Divides the current duration by a set value.
valid :: boolean [R] Is this object valid?
object_name :: string [R] The class name of this object.
help() → string All methods, and properties that this object supports.
reset()

Resets the clock, also restarting it.

stop()

Stops the clock.

restart()

Start the clock again, without resetting it.

add(other)

Add the duration of another timer to this timer. Useful to reduce start/stop overhead when accumulating time onto many timers at once.

Parameters
other :: LuaProfiler: The timer to add to this timer.
Note: If other is running, the time to now will be added.
divide(number)

Divides the current duration by a set value. Useful for calculating the average of many iterations.

Parameters
number :: double: The number to divide by. Must be > 0.
Note: Does nothing if this isn't stopped.