Skip to content

Class: profile_timer

Lightweight script profile timer.

Since

OpenXRay 2025-03-19, ac4ba75d, PR #1771

Source

C++ class profile_timer

Custom Constructor

profile_timer

Remarks

The timer accumulates elapsed microseconds between matching start() and stop() calls. Nested starts are counted and only the outermost stop adds elapsed time.

Extends

Constructors

Constructor

ts
new profile_timer(): profile_timer;

Create a stopped profile timer.

Returns

profile_timer

Overrides

EngineBinding.constructor

Constructor

ts
new profile_timer(timer: profile_timer): profile_timer;

Copy an existing timer.

Parameters

ParameterTypeDescription
timerprofile_timerTimer to copy.

Returns

profile_timer

Overrides

ts
EngineBinding.constructor

Methods

start()

ts
start(): void;

Start or restart measuring elapsed time.

Returns

void

Remarks

Calling start() while the timer is already running increases the recursion mark instead of restarting the underlying clock.


stop()

ts
stop(): void;

Stop measuring elapsed time.

Returns

void

Remarks

Calling stop() on a timer that was not started is ignored.


time()

ts
time(): number;

Returns

number

Elapsed time in microseconds.


toString()

ts
toString(): string;

Overridden string cast is implemented for profiling timer.

Returns

string

Serialized profile time.

Properties

__name

ts
readonly __name: string;

LuaBind instance constructor name.

Inherited from

EngineBinding.__name


__name

ts
readonly static __name: string;

LuaBind class constructor name.

Inherited from

EngineBinding.__name