A small utility class for timing how long functions take. Specify a string as a label (or don't, by default it uses the name of the function it was called from.)

Example:


var perf = new Perf();
...
perf.print();

Constructor

new(?label:String, ?posInfos:Null<PosInfos>)

Create a new performance marker.

Parameters:

label

Optionally specify a label to use for the performance marker. Defaults to the function name.

posInfos

The position of the calling function. Used to build the default label. Note: haxe.PosInfos is magic and automatically populated by the compiler!

Methods

duration():Float

The duration in seconds since this Perf was created.

Returns:

The duration in seconds

durationClean():Float

A rounded millisecond duration

Returns:

The duration in milliseconds

print():Void

Cleanly prints the duration since this Perf was created.