Explorar el Código

More detailed tracing of slow operation in ApplicationConnection.

tags/7.0.0.alpha2
Henri Sara hace 12 años
padre
commit
f977707173
Se han modificado 1 ficheros con 82 adiciones y 5 borrados
  1. 82
    5
      src/com/vaadin/terminal/gwt/client/ApplicationConnection.java

+ 82
- 5
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java Ver fichero



private final RpcManager rpcManager; private final RpcManager rpcManager;


public static class MultiStepDuration extends Duration {
private int previousStep = elapsedMillis();

public void logDuration(String message) {
logDuration(message, 0);
}

public void logDuration(String message, int minDuration) {
int currentTime = elapsedMillis();
int stepDuration = currentTime - previousStep;
if (stepDuration >= minDuration) {
VConsole.log(message + ": " + stepDuration + " ms");
}
previousStep = currentTime;
}
}

public ApplicationConnection() { public ApplicationConnection() {
view = GWT.create(RootConnector.class); view = GWT.create(RootConnector.class);
rpcManager = GWT.create(RpcManager.class); rpcManager = GWT.create(RpcManager.class);
return; return;
} }


MultiStepDuration handleUIDLDuration = new MultiStepDuration();

// Get security key // Get security key
if (json.containsKey(UIDL_SECURITY_TOKEN_ID)) { if (json.containsKey(UIDL_SECURITY_TOKEN_ID)) {
uidlSecurityKey = json.getString(UIDL_SECURITY_TOKEN_ID); uidlSecurityKey = json.getString(UIDL_SECURITY_TOKEN_ID);
resourcesMap.put(key, resources.getAsString(key)); resourcesMap.put(key, resources.getAsString(key));
} }
} }
VConsole.log("Handling type inheritance map from server");
handleUIDLDuration.logDuration(
" * Handling resources from server completed", 10);

VConsole.log(" * Handling type inheritance map from server");


if (json.containsKey("typeInheritanceMap")) { if (json.containsKey("typeInheritanceMap")) {
configuration.addComponentInheritanceInfo(json configuration.addComponentInheritanceInfo(json
.getValueMap("typeInheritanceMap")); .getValueMap("typeInheritanceMap"));
} }
handleUIDLDuration.logDuration(
" * Handling type inheritance map from server completed", 10);

VConsole.log("Handling type mappings from server"); VConsole.log("Handling type mappings from server");


if (json.containsKey("typeMappings")) { if (json.containsKey("typeMappings")) {
json.getValueMap("typeMappings"), widgetSet); json.getValueMap("typeMappings"), widgetSet);
} }


handleUIDLDuration.logDuration(
" * Handling type mappings from server completed", 10);

Command c = new Command() { Command c = new Command() {
public void execute() { public void execute() {
VConsole.log(" * Dumping UIDL");
MultiStepDuration updateDuration = new MultiStepDuration();

VConsole.log(" * Dumping UIDL to the console");
VConsole.dirUIDL(json, configuration); VConsole.dirUIDL(json, configuration);


updateDuration.logDuration(
" * Dumping UIDL to the console completed", 10);

if (json.containsKey("locales")) { if (json.containsKey("locales")) {
VConsole.log(" * Handling locales"); VConsole.log(" * Handling locales");
// Store locale data // Store locale data
LocaleService.addLocales(valueMapArray); LocaleService.addLocales(valueMapArray);
} }


updateDuration.logDuration(" * Handling locales completed", 10);

boolean repaintAll = false; boolean repaintAll = false;
ValueMap meta = null; ValueMap meta = null;
if (json.containsKey("meta")) { if (json.containsKey("meta")) {
} }
} }


updateDuration.logDuration(
" * Handling meta information completed", 10);

if (redirectTimer != null) { if (redirectTimer != null) {
redirectTimer.schedule(1000 * sessionExpirationInterval); redirectTimer.schedule(1000 * sessionExpirationInterval);
} }


componentCaptionSizeChanges.clear(); componentCaptionSizeChanges.clear();


Duration updateDuration = new Duration();
int startProcessing = updateDuration.elapsedMillis();


// Ensure that all connectors that we are about to update exist // Ensure that all connectors that we are about to update exist
createConnectorsIfNeeded(json); createConnectorsIfNeeded(json);


updateDuration.logDuration(" * Creating connectors completed",
10);

// Update states, do not fire events // Update states, do not fire events
Collection<StateChangeEvent> pendingStateChangeEvents = updateConnectorState(json); Collection<StateChangeEvent> pendingStateChangeEvents = updateConnectorState(json);


updateDuration.logDuration(
" * Update of connector states completed", 10);

// Update hierarchy, do not fire events // Update hierarchy, do not fire events
Collection<ConnectorHierarchyChangeEvent> pendingHierarchyChangeEvents = updateConnectorHierarchy(json); Collection<ConnectorHierarchyChangeEvent> pendingHierarchyChangeEvents = updateConnectorHierarchy(json);


updateDuration.logDuration(
" * Update of connector hierarchy completed", 10);

// Fire hierarchy change events // Fire hierarchy change events
sendHierarchyChangeEvents(pendingHierarchyChangeEvents); sendHierarchyChangeEvents(pendingHierarchyChangeEvents);


updateDuration.logDuration(
" * Hierarchy state change event processing completed",
10);

// Fire state change events. // Fire state change events.
sendStateChangeEvents(pendingStateChangeEvents); sendStateChangeEvents(pendingStateChangeEvents);


updateDuration.logDuration(
" * State change event processing completed", 10);

// Update of legacy (UIDL) style connectors // Update of legacy (UIDL) style connectors
updateVaadin6StyleConnectors(json); updateVaadin6StyleConnectors(json);


updateDuration
.logDuration(
" * Vaadin 6 style connector updates (updateFromUidl) completed",
10);

// Handle any RPC invocations done on the server side // Handle any RPC invocations done on the server side
handleRpcInvocations(json); handleRpcInvocations(json);


updateDuration.logDuration(
" * Processing of RPC invocations completed", 10);

if (json.containsKey("dd")) { if (json.containsKey("dd")) {
// response contains data for drag and drop service // response contains data for drag and drop service
VDragAndDropManager.get().handleServerResponse( VDragAndDropManager.get().handleServerResponse(
json.getValueMap("dd")); json.getValueMap("dd"));
} }


updateDuration
.logDuration(
" * Processing of drag and drop server response completed",
10);

unregisterRemovedConnectors(); unregisterRemovedConnectors();
VConsole.log("updateFromUidl: "
+ updateDuration.elapsedMillis() + " ms");

updateDuration.logDuration(
" * Unregistering of removed components completed", 10);

VConsole.log("handleUIDLMessage: "
+ (updateDuration.elapsedMillis() - startProcessing)
+ " ms");


doLayout(false); doLayout(false);


updateDuration
.logDuration(" * Layout processing completed", 10);

if (meta != null) { if (meta != null) {
if (meta.containsKey("appError")) { if (meta.containsKey("appError")) {
ValueMap error = meta.getValueMap("appError"); ValueMap error = meta.getValueMap("appError");
} }
} }


updateDuration.logDuration(" * Error handling completed", 10);

// TODO build profiling for widget impl loading time // TODO build profiling for widget impl loading time


final long prosessingTime = (new Date().getTime()) final long prosessingTime = (new Date().getTime())

Cargando…
Cancelar
Guardar