The Profile object uses the TurbulenzEngine.time to provide a high precision timing. This can be with in a single function, e.g. timing the main loop and functions with in it, or over several frames, e.g. measuring the start up time.
The Profile object is a singleton, it does not have a create().
See Profiling JavaScript for an overview of profiling.
Required scripts
The Profile object requires:
/*{{ javascript("jslib/utilities.js") }}*/
Summary
Starts a profiling sampler with a given unique name.
Syntax
Profile.start("myFunction");
// Code to sample
Profile.stop("myFunction");
Summary
Stops a profiling sampler with a given unique name. If you are profiling a function make sure all code paths that return call stop().
Syntax
Profile.start("myFunction");
// Code to sample
Profile.stop("myFunction");
Summary
Gets a string that contains all the report data. Each line of text is data formatted with the following properties:
Usually this will be called outside of any start/stop pair, e.g. at the end of the main loop.
Syntax
var text = Profile.getReport(sortMode, format);
Optional. An object specifying the format of the output with the following properties.
A dictionary of objects, keyed off the names passed in to start().
Each object has the following properties:
Syntax
var profile = Profile.profiles["myFunction"];
var averageTime = profile.duration / profile.calls;
An enumeration used in the getReport method.