use of com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler in project cuba by cuba-platform.
the class CubaMessageHandler method finishHandlingJsonCommand.
@Override
protected void finishHandlingJsonCommand() {
super.finishHandlingJsonCommand();
ScreenClientProfiler profiler = ScreenClientProfiler.getInstance();
String profilerMarker = profiler.getProfilerMarker();
if (profilerMarker != null) {
profiler.registerClientTime(profilerMarker, lastProcessingTime);
}
profiler.clearProfilerMarker();
}
use of com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler in project cuba by cuba-platform.
the class CubaMessageHandler method startHandlingJsonCommand.
@Override
protected void startHandlingJsonCommand(ValueMap json) {
super.startHandlingJsonCommand(json);
String profilerMarker = ScreenClientProfiler.getProfilerMarkerFromJson(json);
ScreenClientProfiler profiler = ScreenClientProfiler.getInstance();
if (profilerMarker != null) {
profiler.setProfilerMarker(profilerMarker);
profiler.setEnabled(true);
} else {
profiler.clearProfilerMarker();
}
}
use of com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler in project cuba by cuba-platform.
the class CubaXhrConnection method createResponseHandler.
@Override
protected XhrResponseHandler createResponseHandler() {
return new XhrResponseHandler() {
protected int serverTimeOnClient;
@Override
public void onResponseReceived(Request request, Response response) {
int statusCode = response.getStatusCode();
if (statusCode == 200) {
serverTimeOnClient = (int) Util.round(Profiler.getRelativeTimeMillis() - requestStartTime, 0);
}
super.onResponseReceived(request, response);
}
@Override
protected void beforeHandlingMessage(ValueMap json) {
super.beforeHandlingMessage(json);
ScreenClientProfiler profiler = ScreenClientProfiler.getInstance();
String profilerMarker = ScreenClientProfiler.getProfilerMarkerFromJson(json);
if (profilerMarker != null) {
int serverTimeOnServer = ScreenClientProfiler.getServerTimeFromJson(json);
if (serverTimeOnServer > 0) {
profiler.registerServerTime(profilerMarker, serverTimeOnServer);
profiler.registerNetworkTime(profilerMarker, serverTimeOnClient - serverTimeOnServer);
} else {
profiler.registerServerTime(profilerMarker, serverTimeOnClient);
}
profiler.registerEventTs(profilerMarker, ScreenClientProfiler.getEventTsFromJson(json));
}
}
};
}
Aggregations