GWT Grid - how to measure rendering time on client
we've got an application developed in java, with GWT providing the frontent. The application is used on a variety of hardware specifications, e.g. also on older machines. Of course users complain about performance.
We'd like to collect profiling data from real-world users. So far we can measure the pure server-side duration (that's easy) and the duration of the network roundtrip (not so easy, but we managed that).
The hardest part for us is measuring the time elapsed between "user clicking on search button" and "first xxx rows of grid开发者_C百科 have been displayed".
Any idea?
Thanks Holger
I would play around with creating a timestamp at the start of the page load and a timestamp at the end. I believe that "the beginning" would be "onModuleLoad" and the end would be after your last element/widget is added. I hope I have given you a good idea of where to start. You can play with moving these timestamps around to mazimize the time difference that you get. Once you feel confident that you are getting the rendering time, you can save the time difference in a database so that whenever anyone uses your page you get more user data.
Try using SpeedTracer, it's a google chrome plugin developed by google itself
There is no full-stack solution at the moment as far as I know. What you could build internally is a combination of remote logging, gwt lightweight measurements and deferred binding magic.
The first part is to understand that all RPC events and initialization sequence are already measured and how to plug in into that: http://code.google.com/webtoolkit/doc/latest/DevGuideLightweightMetrics.html
The second part is adding Deferred Binding magic to measure onSuccess() method execution time of application Callbacks. The inspiration (but not a solution) could be found here: http://josephmarques.wordpress.com/2010/11/29/performance-monitoring-using-gwt/
The final part is delivering back to client. Here you may use gwt-log or new gwt logging possibilities. Not sure if they implemented that in JDK logging though.
I was thinking to create an embeddable open source library today as we have solved exactly the same problem recently and in process of porting that to GWT 2.0 :)
But I guess it will take some time from idea to implementation...
Hope it helps.
Dmitry
You can use the Duration class available on GWT Client side. com.google.gwt.core.client.Duration
It is a utility class for measuring elapsed time on the client side.
Example usage:
Duration duration = new Duration();
doSomething(); //Returns the number of milliseconds that have elapsed since this object was created.
GWT.log("time taken for doSomething() to complete: "+duration.elapsedMillis());
Documentation
More examples
精彩评论