use of com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo 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();
}
use of com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo 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);
}
use of com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo 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);
}
Aggregations