PDA

View Full Version : suggestions on how to measure time it takes to get data from server?



ttbgwt
22 May 2012, 8:18 AM
We want to offer a debug area in our app that will show each server side call that is being made, and the time it takes to get the call back. Any suggestions on how to approach this? We can show the calls being made, but are not sure of approach to generically calculate timing of each call?



// Capture JsonP events for debug/trace
Ext.override(Ext.data.JsonP, {
handleResponse: function (result, request) {
console.debug('JsonP request made to ' + request.url);
this.callParent(arguments);
}
});
// Capture Ajax events for debug/trace
Ext.util.Observable.observe(Ext.data.Connection);
Ext.data.Connection.on('beforerequest', function (con, options) {
console.log('Ajax request made to ' + options.url);
});

LesJ
22 May 2012, 8:27 AM
There you go :)

http://getfirebug.com/wiki/index.php/Net_Panel

http://getfirebug.com/network

ttbgwt
22 May 2012, 8:59 AM
I want to build this into our app, we already use firebug for debugging our code...

SebTardif
22 May 2012, 6:10 PM
You should use the Filter pattern on your server side. In Java, the Servlet specification has a mechanism called "Filter", you can intercept start and end of all requests, calculate the time, and then call your prefered logger.