diff --git a/examples/libraries/usertimingExample.js b/examples/libraries/usertimingExample.js index a43496a6b9..a1a0800d3d 100644 --- a/examples/libraries/usertimingExample.js +++ b/examples/libraries/usertimingExample.js @@ -1,16 +1,16 @@ Script.include('usertiming.js'); var timing = loadUserTiming(); //set a mark -timing.performance.mark('mark_fully_loaded') +timing.performance.mark('firstMark') + +//do something that takes time -- we're just going to set a timeout here as an example -var count = 0; Script.setTimeout(function() { - //do something that takes time //and set another mark - timing.performance.mark('mark_fully_loaded2') + timing.performance.mark('secondMark') //measure time between marks (first parameter is a name for the measurement) - timing.performance.measure('howlong', 'mark_fully_loaded', 'mark_fully_loaded2'); - //you can also get the marks, but the measure is usually what you're looking for - var items = timing.performance.getEntriesByType('measure'); - print('items is:::' + JSON.stringify(items)) -}, 1000) \ No newline at end of file + timing.performance.measure('howlong', 'firstMark', 'secondMark'); + //you can also get the marks by changing the type below + var measures = timing.performance.getEntriesByType('measure'); + print('measures:::' + JSON.stringify(measures)) +}, 1000)