mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Update usertimingExample.js
This commit is contained in:
parent
4fbff5d667
commit
369eec2abd
1 changed files with 6 additions and 4 deletions
|
@ -1,16 +1,18 @@
|
||||||
Script.include('usertiming.js');
|
Script.include('usertiming.js');
|
||||||
var timing = loadUserTiming();
|
var timing = loadUserTiming();
|
||||||
//set a mark
|
//set a mark
|
||||||
timing.performance.mark('firstMark')
|
timing.performance.mark('firstMark');
|
||||||
|
|
||||||
//do something that takes time -- we're just going to set a timeout here as an example
|
//do something that takes time -- we're just going to set a timeout here as an example
|
||||||
|
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
//and set another mark
|
//and set another mark
|
||||||
timing.performance.mark('secondMark')
|
timing.performance.mark('secondMark');
|
||||||
//measure time between marks (first parameter is a name for the measurement)
|
|
||||||
|
//measure time between marks (first parameter is a name for the measurement)
|
||||||
timing.performance.measure('howlong', 'firstMark', 'secondMark');
|
timing.performance.measure('howlong', 'firstMark', 'secondMark');
|
||||||
//you can also get the marks by changing the type below
|
|
||||||
|
//you can also get the marks by changing the type
|
||||||
var measures = timing.performance.getEntriesByType('measure');
|
var measures = timing.performance.getEntriesByType('measure');
|
||||||
print('measures:::' + JSON.stringify(measures))
|
print('measures:::' + JSON.stringify(measures))
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
Loading…
Reference in a new issue