Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/skip-mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Apr 16, 2021
2 parents b4d8c56 + f101ec3 commit b95bad1
Show file tree
Hide file tree
Showing 82 changed files with 2,449 additions and 547 deletions.
7 changes: 4 additions & 3 deletions infra/schema-pure-jaxb/pom.xml
Expand Up @@ -48,9 +48,10 @@
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>target/midpoint-schema</directory>
</resource>
<!-- Commented out experimentally, as this fools IDEA into searching for XSD types at this location as well. -->
<!--<resource>-->
<!-- <directory>target/midpoint-schema</directory>-->
<!--</resource>-->
</resources>
<plugins>
<plugin>
Expand Down
Expand Up @@ -7,13 +7,71 @@

package com.evolveum.midpoint.schema.statistics;

import static com.evolveum.midpoint.util.MiscUtil.*;

import java.util.Objects;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkBucketManagementOperationPerformanceInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkBucketManagementPerformanceInformationType;

public class TaskWorkBucketManagementPerformanceInformationUtil {

public static String format(WorkBucketManagementPerformanceInformationType i) {
return format(i, null, null, null);
}

public static String format(WorkBucketManagementPerformanceInformationType i, AbstractStatisticsPrinter.Options options,
Integer iterations, Integer seconds) {
return new TaskWorkBucketManagementPerformanceInformationPrinter(i, options, iterations, seconds)
.print();
}

public static void addTo(@NotNull WorkBucketManagementPerformanceInformationType aggregate,
@Nullable WorkBucketManagementPerformanceInformationType part) {
if (part == null) {
return;
}

for (WorkBucketManagementOperationPerformanceInformationType operation : part.getOperation()) {
WorkBucketManagementOperationPerformanceInformationType matchingOperation =
findMatchingOperation(aggregate, operation);
if (matchingOperation != null) {
addTo(matchingOperation, operation);
} else {
aggregate.getOperation().add(operation.clone());
}
}
}

@Nullable
private static WorkBucketManagementOperationPerformanceInformationType findMatchingOperation(
@NotNull WorkBucketManagementPerformanceInformationType info,
@NotNull WorkBucketManagementOperationPerformanceInformationType operation) {
for (WorkBucketManagementOperationPerformanceInformationType existingOperation : info.getOperation()) {
if (Objects.equals(existingOperation.getName(), operation.getName())) {
return existingOperation;
}
}
return null;
}

private static void addTo(@NotNull WorkBucketManagementOperationPerformanceInformationType aggregate,
@NotNull WorkBucketManagementOperationPerformanceInformationType part) {
aggregate.setCount(or0(aggregate.getCount()) + or0(part.getCount()));
aggregate.setTotalTime(or0(aggregate.getTotalTime()) + or0(part.getTotalTime()));
aggregate.setMinTime(min(aggregate.getMinTime(), part.getMinTime()));
aggregate.setMaxTime(max(aggregate.getMaxTime(), part.getMaxTime()));
aggregate.setConflictCount(or0(aggregate.getConflictCount()) + or0(part.getConflictCount()));
aggregate.setTotalWastedTime(or0(aggregate.getTotalWastedTime()) + or0(part.getTotalWastedTime()));
aggregate.setMinWastedTime(min(aggregate.getMinWastedTime(), part.getMinWastedTime()));
aggregate.setMaxWastedTime(max(aggregate.getMaxWastedTime(), part.getMaxWastedTime()));
aggregate.setBucketWaitCount(or0(aggregate.getBucketWaitCount()) + or0(part.getBucketWaitCount()));
aggregate.setBucketsReclaimed(or0(aggregate.getBucketsReclaimed()) + or0(part.getBucketsReclaimed()));
aggregate.setTotalWaitTime(or0(aggregate.getTotalWaitTime()) + or0(part.getTotalWaitTime()));
aggregate.setMinWaitTime(min(aggregate.getMinWaitTime(), part.getMinWaitTime()));
aggregate.setMaxWaitTime(max(aggregate.getMaxWaitTime(), part.getMaxWaitTime()));
}
}
Expand Up @@ -110,7 +110,9 @@ public static OperationStatsType getOperationStatsFromTree(TaskType task, PrismC
.iterativeTaskInformation(new IterativeTaskInformationType(prismContext))
.synchronizationInformation(new SynchronizationInformationType(prismContext))
.actionsExecutedInformation(new ActionsExecutedInformationType())
.environmentalPerformanceInformation(new EnvironmentalPerformanceInformationType());
.environmentalPerformanceInformation(new EnvironmentalPerformanceInformationType())
.repositoryPerformanceInformation(new RepositoryPerformanceInformationType())
.workBucketManagementPerformanceInformation(new WorkBucketManagementPerformanceInformationType());

Stream<TaskType> subTasks = TaskTreeUtil.getAllTasksStream(task);
subTasks.forEach(subTask -> {
Expand All @@ -120,6 +122,8 @@ public static OperationStatsType getOperationStatsFromTree(TaskType task, PrismC
SynchronizationInformation.addTo(aggregate.getSynchronizationInformation(), operationStatsBean.getSynchronizationInformation());
ActionsExecutedInformation.addTo(aggregate.getActionsExecutedInformation(), operationStatsBean.getActionsExecutedInformation());
EnvironmentalPerformanceInformation.addTo(aggregate.getEnvironmentalPerformanceInformation(), operationStatsBean.getEnvironmentalPerformanceInformation());
RepositoryPerformanceInformationUtil.addTo(aggregate.getRepositoryPerformanceInformation(), operationStatsBean.getRepositoryPerformanceInformation());
TaskWorkBucketManagementPerformanceInformationUtil.addTo(aggregate.getWorkBucketManagementPerformanceInformation(), operationStatsBean.getWorkBucketManagementPerformanceInformation());
}
});
return aggregate;
Expand Down Expand Up @@ -405,6 +409,11 @@ public static String format(OperationStatsType statistics) {
.append(CachePerformanceInformationUtil.format(statistics.getCachesPerformanceInformation()))
.append("\n");
}
if (statistics.getWorkBucketManagementPerformanceInformation() != null) {
sb.append("Work bucket management performance information\n\n")
.append(TaskWorkBucketManagementPerformanceInformationUtil.format(statistics.getWorkBucketManagementPerformanceInformation()))
.append("\n");
}
if (statistics.getOperationsPerformanceInformation() != null) {
sb.append("Methods performance information\n\n")
.append(OperationsPerformanceInformationUtil.format(statistics.getOperationsPerformanceInformation()))
Expand Down

0 comments on commit b95bad1

Please sign in to comment.