From 14d5e7e77ebf1cb8ba7c96aaba0d113ab3c6c862 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Fri, 15 Feb 2013 15:42:49 +0200 Subject: [PATCH] Gather more profiling data (#10961) Change-Id: Ifbb2037290a89fd289407d722962b08f286d887e --- .../client/ApplicationConfiguration.java | 6 +++++ .../vaadin/client/ApplicationConnection.java | 4 ++-- client/src/com/vaadin/client/VTooltip.java | 2 ++ .../client/metadata/AsyncBundleLoader.java | 4 ++++ .../client/ui/AbstractComponentConnector.java | 23 ++++++++++++++++++- .../vaadin/client/ui/AbstractConnector.java | 4 ++++ .../src/com/vaadin/client/ui/VCssLayout.java | 4 ++++ client/src/com/vaadin/client/ui/VUI.java | 3 +++ .../client/ui/label/LabelConnector.java | 6 +++++ 9 files changed, 53 insertions(+), 3 deletions(-) diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index 5c3ec36d78..9ba660626e 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -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 diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 44c7397655..3157bd0685 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -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"); diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java index 6e365b4017..759b90a8cd 100644 --- a/client/src/com/vaadin/client/VTooltip.java +++ b/client/src/com/vaadin/client/VTooltip.java @@ -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"); } } diff --git a/client/src/com/vaadin/client/metadata/AsyncBundleLoader.java b/client/src/com/vaadin/client/metadata/AsyncBundleLoader.java index e0ebb5e047..6be89c9cc9 100644 --- a/client/src/com/vaadin/client/metadata/AsyncBundleLoader.java +++ b/client/src/com/vaadin/client/metadata/AsyncBundleLoader.java @@ -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) { diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index e35e3eafcf..e3bdc5a93f 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -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 *

*/ 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"); } /** diff --git a/client/src/com/vaadin/client/ui/AbstractConnector.java b/client/src/com/vaadin/client/ui/AbstractConnector.java index 32f5370dc3..2c76aa93fe 100644 --- a/client/src/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractConnector.java @@ -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"); } /** diff --git a/client/src/com/vaadin/client/ui/VCssLayout.java b/client/src/com/vaadin/client/ui/VCssLayout.java index 0936859ace..4357116707 100644 --- a/client/src/com/vaadin/client/ui/VCssLayout.java +++ b/client/src/com/vaadin/client/ui/VCssLayout.java @@ -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"); } } diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index 6e6bcaf587..b627d4a2a9 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -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) diff --git a/client/src/com/vaadin/client/ui/label/LabelConnector.java b/client/src/com/vaadin/client/ui/label/LabelConnector.java index 896c9d8573..9639987e8d 100644 --- a/client/src/com/vaadin/client/ui/label/LabelConnector.java +++ b/client/src/com/vaadin/client/ui/label/LabelConnector.java @@ -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"); } } -- 2.39.5