var WidgetManager = require("jimu/WidgetManager"); var Extent = require("esri/geometry/Extent"); var wm = WidgetManager.getInstance(); var map = wm.getAllWidgets()[0].map; //Fires when one or more layers begins updating their content. There is a gap between the set-extent and update-start event and it can be quite large. //Fires after layers that are updating their content have completed. var listener1 = map.on('update-start', function(e){ startTime = new Date().getTime()/1000; updateStarts.push(startTime); console.log('start: ' + new Date().getTime()/1000); }); var listener2 = map.on('update-end', function(e){ endTime = new Date().getTime()/1000; updateEnds.push(endTime); console.log( metrics1.length, 'stop: ' + (endTime - startTime), endTime - startExtentTime, startTime - startExtentTime, zzz); metrics1.push(endTime - startTime); metrics2.push(endTime - startExtentTime); if (metrics1.length == extents.length){ console.log(metrics1); console.log(metrics2); calculateStats(); } }); var breakPeriod = 10; //seconds allowed for the operation to complete before the next operation is called //this needs to be greater than the longest possible response time otherwise the results may be skewed extents = [{"xmin":16675516.081326026,"ymin":-3434556.727452047,"xmax":16678386.052872181,"ymax":-3433499.7466703802,"spatialReference":{"wkid":102100}} , {"xmin":16676258.057948027,"ymin":-3434093.029386024,"xmax":16677693.043721423,"ymax":-3433564.538995073,"spatialReference":{"wkid":102100}} , {"xmin":16676723.39821615,"ymin":-3433886.261252783,"xmax":16677440.89110253,"ymax":-3433622.0160574247,"spatialReference":{"wkid":102100}} , {"xmin":16676994.846705677,"ymin":-3433865.547116706,"xmax":16677174.219927272,"ymax":-3433799.4858178664,"spatialReference":{"wkid":102100}} , {"xmin":16676367.040429777,"ymin":-3434096.7616627617,"xmax":16677802.026203172,"ymax":-3433568.271271811,"spatialReference":{"wkid":102100}} , {"xmin":16665604.64713091,"ymin":-3438060.439594304,"xmax":16688564.419502039,"ymax":-3429604.5933402684,"spatialReference":{"wkid":102100}} , {"xmin":16680025.567412717,"ymin":-3436310.1510793893,"xmax":16682895.538958872,"ymax":-3435253.1702977223,"spatialReference":{"wkid":102100}} , {"xmin":16680207.403936861,"ymin":-3436121.7457480263,"xmax":16681642.389710257,"ymax":-3435593.2553570755,"spatialReference":{"wkid":102100}} , {"xmin":16680648.260469358,"ymin":-3435925.726571889,"xmax":16681365.753355738,"ymax":-3435661.481376531,"spatialReference":{"wkid":102100}} , {"xmin":16675267.063819608,"ymin":-3437907.5655377777,"xmax":16686746.950005488,"ymax":-3433679.6424106425,"spatialReference":{"wkid":102100}} , {"xmin":16678862.58997068,"ymin":-3437970.2677874863,"xmax":16681732.561516834,"ymax":-3436913.2870058194,"spatialReference":{"wkid":102100}} , {"xmin":16680329.971906213,"ymin":-3437658.100158295,"xmax":16681047.464792592,"ymax":-3437393.854962937,"spatialReference":{"wkid":102100}} ]; function calculateStats(){ script = require('dojo/io/script'); var deferred = script.get({url:'//cdn.jsdelivr.net/jstat/latest/jstat.min.js'}); deferred.then(function() { s1=jStat(metrics1); s2=jStat(metrics2); console.log(s1.min(), s1.mean(), s1.median(), s1.max(), s1.sum(), s1.stdev(), metrics1.length); console.log(s2.min(), s2.mean(), s2.median(), s2.max(), s2.sum(), s2.stdev(), metrics2.length); var m1 = []; var m2 = []; for (var i=0; i