Search in sources :

Example 1 with PerformanceCategory

use of com.evolveum.midpoint.schema.traces.PerformanceCategory in project midpoint by Evolveum.

the class BaseVisualizer method printPerfData.

private String printPerfData(StringBuilder sb, OpNode opNode) {
    StringBuilder nullPrefix = new StringBuilder();
    boolean showTotals = opNode.showTotals();
    char showTotalsFlag = showTotals ? '*' : ' ';
    if (opNode.isShowDurationBefore()) {
        Double milliseconds = opNode.getMilliseconds();
        String text;
        if (milliseconds != null) {
            text = String.format("%8.1f ms", defaultIfNull(milliseconds, 0.0));
        } else {
            text = StringUtils.repeat(" ", 11);
        }
        appendTextOrSpaces(sb, text, true);
        sb.append(SEPARATOR_FIRST);
        appendTextOrSpaces(nullPrefix, text, false);
        nullPrefix.append(SEPARATOR_CONTINUATION);
    }
    for (Pair<PerformanceCategory, PerformanceCategoryInfo> pair : opNode.getCounts()) {
        PerformanceCategory category = pair.getLeft();
        PerformanceCategoryInfo info = pair.getRight();
        int count = showTotals ? info.getTotalCount() : info.getOwnCount();
        String text = String.format("%s %5d%c", category.getShortLabel(), count, showTotalsFlag);
        appendTextOrSpaces(sb, text, count > 0);
        sb.append(SEPARATOR_FIRST);
        appendTextOrSpaces(nullPrefix, text, false);
        nullPrefix.append(SEPARATOR_CONTINUATION);
    }
    for (Pair<PerformanceCategory, PerformanceCategoryInfo> pair : opNode.getTimes()) {
        PerformanceCategory category = pair.getLeft();
        PerformanceCategoryInfo info = pair.getRight();
        long time = showTotals ? info.getTotalTime() : info.getOwnTime();
        String text = String.format("%s %8.1f ms%c", category.getShortLabel(), time / 1000.0, showTotalsFlag);
        appendTextOrSpaces(sb, text, time > 0);
        sb.append(SEPARATOR_FIRST);
        appendTextOrSpaces(nullPrefix, text, false);
        nullPrefix.append(SEPARATOR_CONTINUATION);
    }
    return nullPrefix.toString();
}
Also used : PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) PerformanceCategoryInfo(com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo)

Example 2 with PerformanceCategory

use of com.evolveum.midpoint.schema.traces.PerformanceCategory in project midpoint-studio by Evolveum.

the class OpPerformancePanel method initLayout.

private void initLayout() {
    JBSplitter split = new OnePixelSplitter(false);
    List<TreeTableColumnDefinition<Map.Entry<PerformanceCategory, PerformanceCategoryInfo>, ?>> categoryColumns = new ArrayList<>();
    categoryColumns.add(new TreeTableColumnDefinition<>("Category", 200, o -> o.getKey().getLabel()));
    categoryColumns.add(new TreeTableColumnDefinition<>("Total #", 50, o -> o.getValue().getTotalCount()));
    categoryColumns.add(new TreeTableColumnDefinition<>("Total time", 70, o -> formatTime(o.getValue().getTotalTime())));
    categoryColumns.add(new TreeTableColumnDefinition<>("Own #", 50, o -> o.getValue().getOwnCount()));
    categoryColumns.add(new TreeTableColumnDefinition<>("Own time", 70, o -> formatTime(o.getValue().getOwnTime())));
    this.category = new JBTable(new ListTableModel(categoryColumns, new ArrayList<>()));
    split.setFirstComponent(new JBScrollPane(category));
    List<TreeTableColumnDefinition<SingleOperationPerformanceInformationType, ?>> operationColumns = new ArrayList<>();
    operationColumns.add(new TreeTableColumnDefinition<>("Operation", 500, o -> o.getName()));
    operationColumns.add(new TreeTableColumnDefinition<>("Count", 50, o -> o.getInvocationCount()));
    operationColumns.add(new TreeTableColumnDefinition<>("Total time", 100, o -> formatTime(o.getTotalTime())));
    operationColumns.add(new TreeTableColumnDefinition<>("Min", 50, o -> formatTime(o.getMinTime())));
    operationColumns.add(new TreeTableColumnDefinition<>("Max", 50, o -> formatTime(o.getMaxTime())));
    operationColumns.add(new TreeTableColumnDefinition<>("Avg", 50, o -> formatTime(o.getTotalTime() / o.getInvocationCount())));
    this.operation = new JBTable(new ListTableModel<>(operationColumns, new ArrayList<>()));
    split.setSecondComponent(new JBScrollPane(operation));
    add(split, BorderLayout.CENTER);
}
Also used : MidPointUtils.formatTime(com.evolveum.midpoint.studio.util.MidPointUtils.formatTime) PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) MidPointProjectNotifier(com.evolveum.midpoint.studio.impl.MidPointProjectNotifier) JBSplitter(com.intellij.ui.JBSplitter) JBScrollPane(com.intellij.ui.components.JBScrollPane) ArrayList(java.util.ArrayList) OpNode(com.evolveum.midpoint.schema.traces.OpNode) java.awt(java.awt) JBTable(com.intellij.ui.table.JBTable) List(java.util.List) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) SingleOperationPerformanceInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SingleOperationPerformanceInformationType) Map(java.util.Map) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) PerformanceCategoryInfo(com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo) Comparator(java.util.Comparator) MessageBus(com.intellij.util.messages.MessageBus) MidPointProjectNotifierAdapter(com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter) ListTableModel(com.evolveum.midpoint.studio.ui.trace.singleOp.model.ListTableModel) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) ArrayList(java.util.ArrayList) PerformanceCategoryInfo(com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) JBTable(com.intellij.ui.table.JBTable) ListTableModel(com.evolveum.midpoint.studio.ui.trace.singleOp.model.ListTableModel) PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) JBSplitter(com.intellij.ui.JBSplitter) Map(java.util.Map) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 3 with PerformanceCategory

use of com.evolveum.midpoint.schema.traces.PerformanceCategory in project midpoint-studio by Evolveum.

the class TraceService method createOptions.

private Options createOptions(PredefinedOpView opViewType) {
    Options options = new Options();
    for (OpType op : OpType.values()) {
        if (opViewType.getTypes().contains(op)) {
            options.getTypesToShow().add(op);
        }
    }
    for (PerformanceCategory pc : PerformanceCategory.values()) {
        if (opViewType.getCategories() == null || opViewType.getCategories().contains(pc)) {
            options.getCategoriesToShow().add(pc);
        }
    }
    options.setShowAlsoParents(opViewType.isShowAlsoParents());
    options.getColumnsToShow().addAll(opViewType.getColumnsToShow());
    return options;
}
Also used : PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) OpType(com.evolveum.midpoint.schema.traces.OpType)

Example 4 with PerformanceCategory

use of com.evolveum.midpoint.schema.traces.PerformanceCategory in project midpoint-studio by Evolveum.

the class OpPerformancePanel method nodeChange.

private void nodeChange(OpNode node) {
    if (node == null) {
        getTableModel(category).setData(new ArrayList());
        getTableModel(operation).setData(new ArrayList());
        return;
    }
    List<Map.Entry<PerformanceCategory, PerformanceCategoryInfo>> categories = new ArrayList<>(node.getPerformanceByCategory().entrySet());
    categories.sort(Comparator.comparing(e -> e.getKey()));
    getTableModel(category).setData(categories);
    List<SingleOperationPerformanceInformationType> operations = new ArrayList<>(node.getPerformance().getOperation());
    operations.sort(Comparator.comparing(SingleOperationPerformanceInformationType::getName));
    getTableModel(operation).setData(operations);
}
Also used : MidPointUtils.formatTime(com.evolveum.midpoint.studio.util.MidPointUtils.formatTime) PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) MidPointProjectNotifier(com.evolveum.midpoint.studio.impl.MidPointProjectNotifier) JBSplitter(com.intellij.ui.JBSplitter) JBScrollPane(com.intellij.ui.components.JBScrollPane) ArrayList(java.util.ArrayList) OpNode(com.evolveum.midpoint.schema.traces.OpNode) java.awt(java.awt) JBTable(com.intellij.ui.table.JBTable) List(java.util.List) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) SingleOperationPerformanceInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SingleOperationPerformanceInformationType) Map(java.util.Map) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) PerformanceCategoryInfo(com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo) Comparator(java.util.Comparator) MessageBus(com.intellij.util.messages.MessageBus) MidPointProjectNotifierAdapter(com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter) ListTableModel(com.evolveum.midpoint.studio.ui.trace.singleOp.model.ListTableModel) SingleOperationPerformanceInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SingleOperationPerformanceInformationType) ArrayList(java.util.ArrayList)

Example 5 with PerformanceCategory

use of com.evolveum.midpoint.schema.traces.PerformanceCategory in project midpoint-studio by Evolveum.

the class TraceOptionsPanel method createOptions.

private Options createOptions() {
    Options rv = new Options();
    for (Map.Entry<OpType, JCheckBox> e : opTypesChecks.entrySet()) {
        if (e.getValue().isSelected()) {
            rv.getTypesToShow().add(e.getKey());
        }
    }
    for (Map.Entry<PerformanceCategory, JCheckBox> e : categoriesChecks.entrySet()) {
        if (e.getValue().isSelected()) {
            rv.getCategoriesToShow().add(e.getKey());
        }
    }
    rv.setShowAlsoParents(alsoParentsCheck.isSelected());
    columnsChecks.entrySet().stream().filter(e -> e.getValue().isSelected()).map(Map.Entry::getKey).forEach(column -> rv.getColumnsToShow().add(column));
    return rv;
}
Also used : Options(com.evolveum.midpoint.studio.impl.trace.Options) PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) OpType(com.evolveum.midpoint.schema.traces.OpType) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

PerformanceCategory (com.evolveum.midpoint.schema.traces.PerformanceCategory)6 PerformanceCategoryInfo (com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo)3 Map (java.util.Map)3 OpNode (com.evolveum.midpoint.schema.traces.OpNode)2 OpType (com.evolveum.midpoint.schema.traces.OpType)2 MidPointProjectNotifier (com.evolveum.midpoint.studio.impl.MidPointProjectNotifier)2 MidPointProjectNotifierAdapter (com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter)2 TreeTableColumnDefinition (com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition)2 ListTableModel (com.evolveum.midpoint.studio.ui.trace.singleOp.model.ListTableModel)2 MidPointUtils.formatTime (com.evolveum.midpoint.studio.util.MidPointUtils.formatTime)2 SingleOperationPerformanceInformationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SingleOperationPerformanceInformationType)2 JBSplitter (com.intellij.ui.JBSplitter)2 OnePixelSplitter (com.intellij.ui.OnePixelSplitter)2 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 JBTable (com.intellij.ui.table.JBTable)2 MessageBus (com.intellij.util.messages.MessageBus)2 BorderLayoutPanel (com.intellij.util.ui.components.BorderLayoutPanel)2 java.awt (java.awt)2 ArrayList (java.util.ArrayList)2 Comparator (java.util.Comparator)2