added functions to test JSONP timings

This commit is contained in:
DennisSchiefer 2012-03-28 13:01:26 +01:00
parent 1a9776cff9
commit 49cc0bfb09
2 changed files with 6 additions and 3 deletions

View File

@ -26,6 +26,7 @@ OSRM.JSONP = {
callbacks: {}, callbacks: {},
timeouts: {}, timeouts: {},
timers: {}, timers: {},
durations: {},
// default callback routines // default callback routines
@ -50,7 +51,7 @@ OSRM.JSONP = {
OSRM.JSONP.fences[id] = undefined; // clean fence OSRM.JSONP.fences[id] = undefined; // clean fence
} }
// OSRM.debug.log("[jsonp] timout handling: "+id); OSRM.debug.log("[jsonp] timout handling: "+id+" "+ (new Date() - OSRM.JSONP.durations[id]) );
}; };
// wrap callback function // wrap callback function
@ -66,7 +67,7 @@ OSRM.JSONP = {
OSRM.JSONP.fences[id] = undefined; // clean fence OSRM.JSONP.fences[id] = undefined; // clean fence
} }
// OSRM.debug.log("[jsonp] response handling: "+id); OSRM.debug.log("[jsonp] response handling: "+id+" "+ (new Date() - OSRM.JSONP.durations[id]) );
}; };
// clean DOM (unfortunately, script elements cannot be reused by all browsers) // clean DOM (unfortunately, script elements cannot be reused by all browsers)
@ -83,6 +84,7 @@ OSRM.JSONP = {
// start timeout timer // start timeout timer
OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout); OSRM.JSONP.timers[id] = setTimeout(OSRM.JSONP.timeouts[id], timeout);
OSRM.JSONP.durations[id] = new Date();
// OSRM.debug.log("[jsonp] init: "+id); // OSRM.debug.log("[jsonp] init: "+id);
return true; return true;
@ -94,5 +96,6 @@ OSRM.JSONP = {
OSRM.JSONP.callbacks = {}; OSRM.JSONP.callbacks = {};
OSRM.JSONP.timeouts = {}; OSRM.JSONP.timeouts = {};
OSRM.JSONP.timers = {}; OSRM.JSONP.timers = {};
OSRM.JSONP.durations = {};
} }
}; };

View File

@ -44,7 +44,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
<script src="OSRM.base.js" type="text/javascript"></script> <script src="OSRM.base.js" type="text/javascript"></script>
<script src="OSRM.config.js" type="text/javascript"></script> <script src="OSRM.config.js" type="text/javascript"></script>
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> --> <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script>
<script src="OSRM.Browser.js" type="text/javascript"></script> <script src="OSRM.Browser.js" type="text/javascript"></script>
<script src="OSRM.GUI.js" type="text/javascript"></script> <script src="OSRM.GUI.js" type="text/javascript"></script>