Search in sources :

Example 31 with Slf4JStopWatch

use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.

the class ClusterManager method internalSend.

protected void internalSend(Serializable message, boolean sync) {
    StopWatch sw = new Slf4JStopWatch(String.format("sendClusterMessage(%s)", message.getClass().getSimpleName()));
    try {
        byte[] bytes = SerializationSupport.serialize(message);
        log.debug("Sending message: {}: {} ({} bytes)", message.getClass(), message, bytes.length);
        MessageStat stat = messagesStat.get(message.getClass().getName());
        if (stat != null) {
            stat.updateSent(bytes.length);
        }
        Message msg = new Message(null, null, bytes);
        if (sync) {
            msg.setFlag(Message.Flag.RSVP);
        }
        try {
            channel.send(msg);
        } catch (Exception e) {
            log.error("Error sending message", e);
        }
    } finally {
        sw.stop();
    }
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) StopWatch(org.perf4j.StopWatch)

Example 32 with Slf4JStopWatch

use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.

the class PerformanceLogInterceptor method aroundInvoke.

@SuppressWarnings({ "UnusedDeclaration", "UnnecessaryLocalVariable" })
private Object aroundInvoke(ProceedingJoinPoint ctx) throws Throwable {
    StopWatch stopWatch = new Slf4JStopWatch(ctx.getSignature().toShortString());
    try {
        stopWatch.start();
        Object res = ctx.proceed();
        return res;
    } finally {
        stopWatch.stop();
    }
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) StopWatch(org.perf4j.StopWatch) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch)

Example 33 with Slf4JStopWatch

use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.

the class JmxInstancesDatasource method loadData.

@Override
protected void loadData(Map<String, Object> params) {
    String tag = getLoggingTag("CDS");
    StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
    detachListener(data.values());
    data.clear();
    for (JmxInstance jmxInstance : jmxControlAPI.getInstances()) {
        data.put(jmxInstance.getId(), jmxInstance);
        attachListener(jmxInstance);
    }
    sw.stop();
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) UIPerformanceLogger(com.haulmont.cuba.gui.logging.UIPerformanceLogger) StopWatch(org.perf4j.StopWatch) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) JmxInstance(com.haulmont.cuba.core.entity.JmxInstance)

Example 34 with Slf4JStopWatch

use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.

the class FrameComponentLoader method loadComponent.

@Override
public void loadComponent() {
    if (resultComponent.getMessagesPack() == null) {
        resultComponent.setMessagesPack(messagesPack);
    }
    assignXmlDescriptor(resultComponent, element);
    loadVisible(resultComponent, element);
    loadStyleName(resultComponent, element);
    loadResponsive(resultComponent, element);
    loadAlign(resultComponent, element);
    loadHeight(resultComponent, element, ComponentsHelper.getComponentHeigth(resultComponent));
    loadWidth(resultComponent, element, ComponentsHelper.getComponentWidth(resultComponent));
    loadIcon(resultComponent, element);
    loadCaption(resultComponent, element);
    loadDescription(resultComponent, element);
    if (context.getFrame() != null) {
        resultComponent.setFrame(context.getFrame());
    }
    String src = element.attributeValue("src");
    String screenId = element.attributeValue("screen");
    String screenPath = StringUtils.isEmpty(screenId) ? src : screenId;
    if (element.attributeValue("id") != null) {
        screenPath = element.attributeValue("id");
    }
    if (context.getFrame() != null) {
        String parentId = context.getFullFrameId();
        if (StringUtils.isNotEmpty(parentId)) {
            screenPath = parentId + "." + screenPath;
        }
    }
    StopWatch loadDescriptorWatch = new Slf4JStopWatch(screenPath + "#" + UIPerformanceLogger.LifeCycle.LOAD, LoggerFactory.getLogger(UIPerformanceLogger.class));
    loadDescriptorWatch.start();
    String currentFrameId = context.getCurrentFrameId();
    try {
        context.setCurrentFrameId(frameId);
        frameLoader.loadComponent();
    } finally {
        context.setCurrentFrameId(currentFrameId);
        loadDescriptorWatch.stop();
    }
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) UIPerformanceLogger(com.haulmont.cuba.gui.logging.UIPerformanceLogger) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) StopWatch(org.perf4j.StopWatch)

Example 35 with Slf4JStopWatch

use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.

the class RuntimePropertiesFrameLoader method loadComponent.

@Override
public void loadComponent() {
    if (resultComponent.getMessagesPack() == null) {
        resultComponent.setMessagesPack(messagesPack);
    }
    assignXmlDescriptor(resultComponent, element);
    loadVisible(resultComponent, element);
    loadStyleName(resultComponent, element);
    loadAlign(resultComponent, element);
    loadHeight(resultComponent, element, ComponentsHelper.getComponentHeigth(resultComponent));
    loadWidth(resultComponent, element, ComponentsHelper.getComponentWidth(resultComponent));
    String src = element.attributeValue("src");
    if (src == null) {
        src = DEFAULT_DESCRIPTOR;
    }
    String runtimeDs = element.attributeValue("runtimeDs");
    if (StringUtils.isEmpty(runtimeDs)) {
        throw new GuiDevelopmentException("runtimePropsDatasource is not set for runtimeProperties component", context.getFullFrameId());
    }
    context.getParams().put("runtimeDs", runtimeDs);
    String categoriesDs = element.attributeValue("categoriesDs");
    if (StringUtils.isEmpty(categoriesDs)) {
        throw new GuiDevelopmentException("categoriesDs is not set for runtimeProperties component", context.getFullFrameId());
    }
    context.getParams().put("categoriesDs", categoriesDs);
    String rows = element.attributeValue("rows");
    context.getParams().put("rows", rows);
    String cols = element.attributeValue("cols");
    context.getParams().put("cols", cols);
    String fieldWidth = element.attributeValue("fieldWidth");
    context.getParams().put("fieldWidth", fieldWidth);
    String fieldCaptionWidth = element.attributeValue("fieldCaptionWidth");
    context.getParams().put("fieldCaptionWidth", fieldCaptionWidth);
    String screenPath = Objects.equals(src, DEFAULT_DESCRIPTOR) ? "runtimeProperties" : src;
    if (element.attributeValue("id") != null) {
        screenPath = element.attributeValue("id");
    }
    if (context.getFrame() != null) {
        String parentId = context.getFullFrameId();
        if (StringUtils.isNotEmpty(parentId)) {
            screenPath = parentId + "." + screenPath;
        }
    }
    StopWatch loadDescriptorWatch = new Slf4JStopWatch(screenPath + "#" + UIPerformanceLogger.LifeCycle.LOAD, LoggerFactory.getLogger(UIPerformanceLogger.class));
    loadDescriptorWatch.start();
    String currentFrameId = context.getCurrentFrameId();
    try {
        context.setCurrentFrameId(frameId);
        frameLoader.loadComponent();
    } finally {
        context.setCurrentFrameId(currentFrameId);
        loadDescriptorWatch.stop();
    }
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) UIPerformanceLogger(com.haulmont.cuba.gui.logging.UIPerformanceLogger) GuiDevelopmentException(com.haulmont.cuba.gui.GuiDevelopmentException) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) StopWatch(org.perf4j.StopWatch)

Aggregations

StopWatch (org.perf4j.StopWatch)37 Slf4JStopWatch (org.perf4j.slf4j.Slf4JStopWatch)37 UIPerformanceLogger (com.haulmont.cuba.gui.logging.UIPerformanceLogger)17 Element (org.dom4j.Element)4 Transaction (com.haulmont.cuba.core.Transaction)3 Test (org.testng.annotations.Test)3 Node (com.haulmont.bali.datastruct.Node)2 MetaClass (com.haulmont.chile.core.model.MetaClass)2 AppFolder (com.haulmont.cuba.core.entity.AppFolder)2 ComponentLoader (com.haulmont.cuba.gui.xml.layout.ComponentLoader)2 ComponentLoaderContext (com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext)2 SearchFolder (com.haulmont.cuba.security.entity.SearchFolder)2 Binding (groovy.lang.Binding)2 IOException (java.io.IOException)2 Pair (com.haulmont.bali.datastruct.Pair)1 Tree (com.haulmont.bali.datastruct.Tree)1 MetaModel (com.haulmont.chile.core.model.MetaModel)1 MetaProperty (com.haulmont.chile.core.model.MetaProperty)1 EntityManager (com.haulmont.cuba.core.EntityManager)1 Entity (com.haulmont.cuba.core.entity.Entity)1