]> source.dussan.org Git - vaadin-framework.git/commitdiff
Gather more profiling data (#10961)
authorLeif Åstrand <leif@vaadin.com>
Fri, 15 Feb 2013 13:42:49 +0000 (15:42 +0200)
committerVaadin Code Review <review@vaadin.com>
Fri, 15 Feb 2013 19:16:34 +0000 (19:16 +0000)
Change-Id: Ifbb2037290a89fd289407d722962b08f286d887e

client/src/com/vaadin/client/ApplicationConfiguration.java
client/src/com/vaadin/client/ApplicationConnection.java
client/src/com/vaadin/client/VTooltip.java
client/src/com/vaadin/client/metadata/AsyncBundleLoader.java
client/src/com/vaadin/client/ui/AbstractComponentConnector.java
client/src/com/vaadin/client/ui/AbstractConnector.java
client/src/com/vaadin/client/ui/VCssLayout.java
client/src/com/vaadin/client/ui/VUI.java
client/src/com/vaadin/client/ui/label/LabelConnector.java

index 5c3ec36d78fcbf452d21f3144fced00a4508b40d..9ba660626e57adf58eaeb954c64246d483f53792 100644 (file)
@@ -381,11 +381,14 @@ public class ApplicationConfiguration implements EntryPoint {
 
             @Override
             public void execute() {
+                Profiler.enter("ApplicationConfiguration.startApplication");
                 ApplicationConfiguration appConf = getConfigFromDOM(applicationId);
                 ApplicationConnection a = GWT
                         .create(ApplicationConnection.class);
                 a.init(widgetSet, appConf);
                 runningApplications.add(a);
+                Profiler.leave("ApplicationConfiguration.startApplication");
+
                 a.start();
             }
         });
@@ -532,6 +535,8 @@ public class ApplicationConfiguration implements EntryPoint {
 
     @Override
     public void onModuleLoad() {
+        Profiler.reset();
+        Profiler.enter("ApplicationConfiguration.onModuleLoad");
 
         BrowserInfo browserInfo = BrowserInfo.get();
 
@@ -567,6 +572,7 @@ public class ApplicationConfiguration implements EntryPoint {
                 VConsole.getImplementation().error(e);
             }
         });
+        Profiler.leave("ApplicationConfiguration.onModuleLoad");
 
         if (SuperDevMode.enableBasedOnParameter()) {
             // Do not start any application as super dev mode will refresh the
index 44c739765566183ca583dbb2d851f4bbb543980e..3157bd06859160878af0a07a42c264b52d305581 100644 (file)
@@ -1311,8 +1311,6 @@ public class ApplicationConnection {
             return;
         }
 
-        Profiler.reset();
-
         VConsole.log("Handling message from server");
         eventBus.fireEvent(new ResponseHandlingStartedEvent(this));
 
@@ -1916,6 +1914,7 @@ public class ApplicationConnection {
                     }
                 }
 
+                Profiler.enter("updateConnectorState newWithoutState");
                 // Fire events for properties using the default value for newly
                 // created connectors even if there were no state changes
                 for (ServerConnector connector : remainingNewConnectors) {
@@ -1928,6 +1927,7 @@ public class ApplicationConnection {
                     events.add(event);
 
                 }
+                Profiler.leave("updateConnectorState newWithoutState");
 
                 Profiler.leave("updateConnectorState");
 
index 6e365b4017b1413b4d6b03c2b47d35cfcf65a0a9..759b90a8cd38d8cc8c968eb3e31ec2e71de7b1c5 100644 (file)
@@ -366,8 +366,10 @@ public class VTooltip extends VOverlay {
      *            Widget which DOM handlers are connected
      */
     public void connectHandlersToWidget(Widget widget) {
+        Profiler.enter("VTooltip.connectHandlersToWidget");
         widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
         widget.addDomHandler(tooltipEventHandler, ClickEvent.getType());
         widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
+        Profiler.leave("VTooltip.connectHandlersToWidget");
     }
 }
index e0ebb5e0479ff6a844055d887fb5fa826a11ea06..6be89c9cc9a4edba69314c2f388e56a93dfca556 100644 (file)
@@ -19,6 +19,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import com.vaadin.client.Profiler;
+
 public abstract class AsyncBundleLoader {
     public enum State {
         NOT_STARTED, LOADING, LOADED, ERROR;
@@ -63,9 +65,11 @@ public abstract class AsyncBundleLoader {
 
     public void load(BundleLoadCallback callback, TypeDataStore store) {
         assert state == State.NOT_STARTED;
+        Profiler.enter("AsyncBundleLoader.load");
         state = State.LOADING;
         addCallback(callback);
         load(store);
+        Profiler.leave("AsyncBundleLoader.load");
     }
 
     public void addCallback(BundleLoadCallback callback) {
index e35e3eafcfc073351d7a8a1361d32a4d4b50fa8e..e3bdc5a93ffcbf6937ea9fecce12b74baec44380 100644 (file)
@@ -27,6 +27,7 @@ import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.HasComponentsConnector;
 import com.vaadin.client.LayoutManager;
+import com.vaadin.client.Profiler;
 import com.vaadin.client.ServerConnector;
 import com.vaadin.client.StyleConstants;
 import com.vaadin.client.TooltipInfo;
@@ -105,7 +106,11 @@ public abstract class AbstractComponentConnector extends AbstractConnector
     @Override
     public Widget getWidget() {
         if (widget == null) {
+            Profiler.enter("AbstractComponentConnector.createWidget for "
+                    + Util.getSimpleName(this));
             widget = createWidget();
+            Profiler.leave("AbstractComponentConnector.createWidget for "
+                    + Util.getSimpleName(this));
         }
 
         return widget;
@@ -123,6 +128,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
 
     @Override
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
+        Profiler.enter("AbstractComponentConnector.onStateChanged");
+        Profiler.enter("AbstractComponentConnector.onStateChanged update id");
         if (stateChangeEvent.hasPropertyChanged("id")) {
             if (getState().id != null) {
                 getWidget().getElement().setId(getState().id);
@@ -130,17 +137,20 @@ public abstract class AbstractComponentConnector extends AbstractConnector
                 getWidget().getElement().removeAttribute("id");
             }
         }
+        Profiler.leave("AbstractComponentConnector.onStateChanged update id");
 
         /*
          * Disabled state may affect (override) tabindex so the order must be
          * first setting tabindex, then enabled state (through super
          * implementation).
          */
+        Profiler.enter("AbstractComponentConnector.onStateChanged update tab index");
         if (getState() instanceof TabIndexState
                 && getWidget() instanceof Focusable) {
             ((Focusable) getWidget())
                     .setTabIndex(((TabIndexState) getState()).tabIndex);
         }
+        Profiler.leave("AbstractComponentConnector.onStateChanged update tab index");
 
         super.onStateChanged(stateChangeEvent);
 
@@ -155,6 +165,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
         updateComponentSize();
 
         initialStateEvent = false;
+
+        Profiler.leave("AbstractComponentConnector.onStateChanged");
     }
 
     @Override
@@ -182,6 +194,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
     }
 
     private void updateComponentSize() {
+        Profiler.enter("AbstractComponentConnector.updateComponentSize");
+
         String newWidth = getState().width == null ? "" : getState().width;
         String newHeight = getState().height == null ? "" : getState().height;
 
@@ -209,11 +223,17 @@ public abstract class AbstractComponentConnector extends AbstractConnector
         // Set defined sizes
         Widget widget = getWidget();
 
+        Profiler.enter("AbstractComponentConnector.updateComponentSize update styleNames");
         widget.setStyleName("v-has-width", !isUndefinedWidth());
         widget.setStyleName("v-has-height", !isUndefinedHeight());
+        Profiler.leave("AbstractComponentConnector.updateComponentSize update styleNames");
 
+        Profiler.enter("AbstractComponentConnector.updateComponentSize update DOM");
         widget.setHeight(newHeight);
         widget.setWidth(newWidth);
+        Profiler.leave("AbstractComponentConnector.updateComponentSize update DOM");
+
+        Profiler.leave("AbstractComponentConnector.updateComponentSize");
     }
 
     @Override
@@ -257,6 +277,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
      * </p>
      */
     protected void updateWidgetStyleNames() {
+        Profiler.enter("AbstractComponentConnector.updateWidgetStyleNames");
         AbstractComponentState state = getState();
 
         String primaryStyleName = getWidget().getStylePrimaryName();
@@ -302,7 +323,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
             }
 
         }
-
+        Profiler.leave("AbstractComponentConnector.updateWidgetStyleNames");
     }
 
     /**
index 32f5370dc3bd7956c178ed301a36bd91c4bf3c9d..2c76aa93fec457c9006b4401e58d6567861e6d0a 100644 (file)
@@ -218,6 +218,7 @@ public abstract class AbstractConnector implements ServerConnector,
         }
         if (statePropertyHandlerManagers != null
                 && event instanceof StateChangeEvent) {
+            Profiler.enter("AbstractConnector.fireEvent statePropertyHandlerManagers");
             StateChangeEvent stateChangeEvent = (StateChangeEvent) event;
             JsArrayString keys = statePropertyHandlerManagers.getKeys();
             for (int i = 0; i < keys.length(); i++) {
@@ -226,6 +227,7 @@ public abstract class AbstractConnector implements ServerConnector,
                     statePropertyHandlerManagers.get(property).fireEvent(event);
                 }
             }
+            Profiler.leave("AbstractConnector.fireEvent statePropertyHandlerManagers");
         }
         if (Profiler.isEnabled()) {
             Profiler.leave(profilerKey);
@@ -400,6 +402,7 @@ public abstract class AbstractConnector implements ServerConnector,
         if (lastEnabledState == enabledState) {
             return;
         }
+        Profiler.enter("AbstractConnector.updateEnabledState");
         lastEnabledState = enabledState;
 
         for (ServerConnector c : getChildren()) {
@@ -407,6 +410,7 @@ public abstract class AbstractConnector implements ServerConnector,
             // their parent
             c.updateEnabledState(c.isEnabled());
         }
+        Profiler.leave("AbstractConnector.updateEnabledState");
     }
 
     /**
index 0936859acefca40f280a62c82317068d6d3effa3..4357116707df83400d24e2d4e196ae1cffdec16b 100644 (file)
@@ -18,6 +18,7 @@ package com.vaadin.client.ui;
 
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.Profiler;
 import com.vaadin.client.StyleConstants;
 
 /**
@@ -41,12 +42,15 @@ public class VCssLayout extends FlowPanel {
      * For internal use only. May be removed or replaced in the future.
      */
     public void addOrMove(Widget child, int index) {
+        Profiler.enter("VCssLayout.addOrMove");
         if (child.getParent() == this) {
             int currentIndex = getWidgetIndex(child);
             if (index == currentIndex) {
+                Profiler.leave("VCssLayout.addOrMove");
                 return;
             }
         }
         insert(child, index);
+        Profiler.leave("VCssLayout.addOrMove");
     }
 }
index 6e6bcaf587ab5554a8af9a72b000a414e846f2b4..b627d4a2a99ddc1a9ad512396e6df3b3b9222ca7 100644 (file)
@@ -41,6 +41,7 @@ import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.ConnectorMap;
 import com.vaadin.client.Focusable;
 import com.vaadin.client.LayoutManager;
+import com.vaadin.client.Profiler;
 import com.vaadin.client.VConsole;
 import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
 import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler;
@@ -395,11 +396,13 @@ public class VUI extends SimplePanel implements ResizeHandler,
      * For internal use only. May be removed or replaced in the future.
      */
     public void sendClientResized() {
+        Profiler.enter("VUI.sendClientResized");
         Element parentElement = getElement().getParentElement();
         int viewHeight = parentElement.getClientHeight();
         int viewWidth = parentElement.getClientWidth();
 
         ResizeEvent.fire(this, viewWidth, viewHeight);
+        Profiler.leave("VUI.sendClientResized");
     }
 
     public native static void goTo(String url)
index 896c9d8573647186d7ab8e2fce1c3bbb76e16e48..9639987e8dad9d25eeb0ef41ed9e38da9bcba61b 100644 (file)
@@ -17,6 +17,7 @@ package com.vaadin.client.ui.label;
 
 import com.google.gwt.dom.client.Document;
 import com.google.gwt.dom.client.PreElement;
+import com.vaadin.client.Profiler;
 import com.vaadin.client.Util;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentConnector;
@@ -44,6 +45,7 @@ public class LabelConnector extends AbstractComponentConnector {
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
         super.onStateChanged(stateChangeEvent);
         boolean sinkOnloads = false;
+        Profiler.enter("LabelConnector.onStateChanged update content");
         switch (getState().contentMode) {
         case PREFORMATTED:
             PreElement preElement = Document.get().createPreElement();
@@ -69,8 +71,12 @@ public class LabelConnector extends AbstractComponentConnector {
             break;
 
         }
+        Profiler.leave("LabelConnector.onStateChanged update content");
+
         if (sinkOnloads) {
+            Profiler.enter("LabelConnector.onStateChanged sinkOnloads");
             Util.sinkOnloadForImages(getWidget().getElement());
+            Profiler.leave("LabelConnector.onStateChanged sinkOnloads");
         }
     }