Search in sources :

Example 1 with ScreenClientProfiler

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();
}
Also used : ScreenClientProfiler(com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler)

Example 2 with ScreenClientProfiler

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();
    }
}
Also used : ScreenClientProfiler(com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler)

Example 3 with ScreenClientProfiler

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));
            }
        }
    };
}
Also used : Response(com.google.gwt.http.client.Response) ScreenClientProfiler(com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler) ValueMap(com.vaadin.client.ValueMap) Request(com.google.gwt.http.client.Request)

Aggregations

ScreenClientProfiler (com.haulmont.cuba.web.toolkit.ui.client.profiler.ScreenClientProfiler)3 Request (com.google.gwt.http.client.Request)1 Response (com.google.gwt.http.client.Response)1 ValueMap (com.vaadin.client.ValueMap)1