How to calculate the time taken to load module in gwt? -
I am using a custom gridview widget and large amounts of data (say 1000 rows). I know that it takes more time. And I want to know how much time it takes to load this grid.
& lt ;; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Link rel = "stylesheet" href = "custom.css" & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; & Lt; Title & gt; CustomWidget & lt; / Title & gt; & Lt; Script type = "text / javascript" language = "javascript" src = "mywidget / mywidget.nocache.js" & gt; Function startTime () {var today = new date (); Var h = today.getHours (); Var m = today.getMinutes (); Var s = today.getSeconds (); // Add a zeros to the numbers & lt; 10 m = checktime (m); S = checkTime (s); . Document.getElementById ('text') innerHTML = h + ":" + m + ":" + s; T = setTimeout (function () {STARTTIME ()}, 500); } Function check time (i) {if (i & lt; 10) {i = "0" + i; } Came back; } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body Onload = "Starttime ()" & gt; & Lt; iframe src = "javascript: '' id =" __gwt_historyFrame "tabIndex = '- 1' style =" status: complete; Width: 0; Height: 0; Limit: 0 "& lt; / iframe> ; but not able to display the time ... and works while executing it as an html page.
Try this one
- Make a hidden light that Before downloading
nocache.js, there is information about the current time - Once
nocache.js is loaded, then it Module load () at callpoint # will call the method of your entry point class. - Compare time to remove time
HTML / JSP :
& lt; body & gt; div id = "timeinfo" style = "visibility: hidden;" & gt; & lt; / div & gt; & lt; script Type = "text / javascript"> var today = new date (); document.getElementById ("timimofo") .internalHTML = today.gate time (); & lt; / Script & gt; & Lt; Script type = "text / javascript" src = "mywidget / mywidget.nocache.js" & gt; & Lt; / Script & gt; & Lt; / Body & gt; Entry Point Class:
Applies the Public Class MyViewd EntryPoint {Module Load on Public Zero (RoutePenicalTyemonFo = RootPanel.Gate ("TIMEInfo" ); Long startTime = long.valof (timenfo.ttable) (). getInnerHTML ()); Long end time = system Time Received (); System.out.println (new date (starttime)); System.out.println (new date (end time)); System.out.println ("Total time taken =" + (endime - starttime) + "ms."); RootPanel.getBodyElement () removeChild (timeinfo.getElement ()). ...}} Output:
Tuesday April 22 16:55:49 IST 2014 Tuesday April 22 16:56:03 IST 2014 total time Took = 14479 ms
Comments
Post a Comment