content/hifi-public/scripts/libraries/usertimingExample.js
Dale Glass 0d14e5a379 Initial data.
Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them
has been replaced with a symlink.

Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still
be present.
2022-02-13 18:59:11 +01:00

18 lines
649 B
JavaScript

Script.include('usertiming.js');
var timing = loadUserTiming();
//set a mark
timing.performance.mark('firstMark');
//do something that takes time -- we're just going to set a timeout here as an example
Script.setTimeout(function() {
//and set another mark
timing.performance.mark('secondMark');
//measure time between marks (first parameter is a name for the measurement)
timing.performance.measure('howlong', 'firstMark', 'secondMark');
//you can also get the marks by changing the type
var measures = timing.performance.getEntriesByType('measure');
print('measures:::' + JSON.stringify(measures))
}, 1000)