summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 1a637e3161..ab9f95e8fd 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -16,7 +16,7 @@
package com.vaadin.client;
-import java.util.ArrayList;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -500,6 +500,7 @@ public class ApplicationConnection {
ap.@com.vaadin.client.ApplicationConnection::totalProcessingTime
];
pd = pd.concat(ap.@com.vaadin.client.ApplicationConnection::serverTimingInfo);
+ pd[pd.length] = ap.@com.vaadin.client.ApplicationConnection::bootstrapTime;
return pd;
});
@@ -513,6 +514,16 @@ public class ApplicationConnection {
$wnd.vaadin.clients[TTAppId] = client;
}-*/;
+ private static native final int calculateBootstrapTime()
+ /*-{
+ if ($wnd.performance && $wnd.performance.timing) {
+ return (new Date).getTime() - $wnd.performance.timing.responseStart;
+ } else {
+ // performance.timing not supported
+ return -1;
+ }
+ }-*/;
+
/**
* Helper for tt initialization
*/
@@ -948,6 +959,15 @@ public class ApplicationConnection {
protected int totalProcessingTime;
/**
+ * Holds the time it took to load the page and render the first view. 0
+ * means that this value has not yet been calculated because the first view
+ * has not yet been rendered (or that your browser is very fast). -1 means
+ * that the browser does not support the performance.timing feature used to
+ * get this measurement.
+ */
+ private int bootstrapTime;
+
+ /**
* Holds the timing information from the server-side. How much time was
* spent servicing the last request and how much time has been spent
* servicing the session so far. These values are always one request behind,
@@ -1512,6 +1532,9 @@ public class ApplicationConnection {
lastProcessingTime = (int) ((new Date().getTime()) - start
.getTime());
totalProcessingTime += lastProcessingTime;
+ if (bootstrapTime == 0) {
+ bootstrapTime = calculateBootstrapTime();
+ }
VConsole.log(" Processing time was "
+ String.valueOf(lastProcessingTime) + "ms for "