Search in sources :

Example 1 with StopWatch

use of org.perf4j.StopWatch in project cuba by cuba-platform.

the class ScreenXmlLoader method load.

/**
 * Loads a descriptor.
 * @param resourcePath  path to the resource containing the XML
 * @param id            screen ID
 * @param params        screen parameters
 * @return root XML element
 */
public Element load(String resourcePath, String id, Map<String, Object> params) {
    StopWatch xmlLoadWatch = new Slf4JStopWatch(id + "#" + UIPerformanceLogger.LifeCycle.XML, LoggerFactory.getLogger(UIPerformanceLogger.class));
    String template = loadTemplate(resourcePath);
    Document document = getDocument(template, params);
    xmlLoadWatch.stop();
    return document.getRootElement();
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) UIPerformanceLogger(com.haulmont.cuba.gui.logging.UIPerformanceLogger) Document(org.dom4j.Document) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) StopWatch(org.perf4j.StopWatch)

Example 2 with StopWatch

use of org.perf4j.StopWatch in project cuba by cuba-platform.

the class AbstractTreeDatasource method loadData.

@Override
protected void loadData(Map<String, Object> params) {
    String tag = getLoggingTag("TDS");
    StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
    clear();
    this.tree = loadTree(params);
    Map<K, Node<T>> targetNodes = new HashMap<>();
    if (tree != null) {
        for (Node<T> node : tree.toList()) {
            final T entity = node.getData();
            final K id = entity.getId();
            data.put(id, entity);
            attachListener(entity);
            targetNodes.put(id, node);
        }
    }
    this.nodes = targetNodes;
    sw.stop();
}
Also used : Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) UIPerformanceLogger(com.haulmont.cuba.gui.logging.UIPerformanceLogger) Node(com.haulmont.bali.datastruct.Node) StopWatch(org.perf4j.StopWatch) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch)

Example 3 with StopWatch

use of org.perf4j.StopWatch in project cuba by cuba-platform.

the class ValueGroupDatasourceImpl method loadData.

@Override
protected void loadData(Map<String, Object> params) {
    String tag = getLoggingTag("VGDS");
    StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
    delegate.loadData(params);
    sw.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 4 with StopWatch

use of org.perf4j.StopWatch in project cuba by cuba-platform.

the class ValueHierarchicalDatasourceImpl method loadData.

@Override
protected void loadData(Map<String, Object> params) {
    String tag = getLoggingTag("VHDS");
    StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
    delegate.loadData(params);
    sw.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 5 with StopWatch

use of org.perf4j.StopWatch in project cuba by cuba-platform.

the class ClusterManager method printSharedStateStat.

@Override
public String printSharedStateStat() {
    StringBuilder clusterStateStat = new StringBuilder();
    for (Map.Entry<String, ClusterListener> entry : listeners.entrySet()) {
        byte[] data = null;
        StopWatch sw = new StopWatch();
        try {
            data = entry.getValue().getState();
        } finally {
            sw.stop();
        }
        clusterStateStat.append(String.format("State: %s, size: %s bytes, serialize time: %s ms\n", entry.getKey(), data != null ? data.length : -1, sw.getElapsedTime()));
    }
    return clusterStateStat.toString();
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) Slf4JStopWatch(org.perf4j.slf4j.Slf4JStopWatch) StopWatch(org.perf4j.StopWatch)

Aggregations

StopWatch (org.perf4j.StopWatch)41 Slf4JStopWatch (org.perf4j.slf4j.Slf4JStopWatch)41 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 KryoException (com.esotericsoftware.kryo.KryoException)1 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