Skip to content

Commit

Permalink
Merge branch 'master' into feature/gui-wrapper
Browse files Browse the repository at this point in the history
# Conflicts:
#	gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/TaskInternalPerformanceTabPanel.java
#	infra/schema/src/main/java/com/evolveum/midpoint/schema/statistics/ActionsExecutedInformation.java
  • Loading branch information
mederly committed Jun 17, 2019
2 parents 5b75c52 + facdf60 commit f56db98
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 5 deletions.
Expand Up @@ -18,15 +18,14 @@
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.prism.PrismObjectWrapper;
import com.evolveum.midpoint.schema.statistics.CachePerformanceInformationUtil;
import com.evolveum.midpoint.schema.statistics.MethodsPerformanceInformationUtil;
import com.evolveum.midpoint.schema.statistics.RepositoryPerformanceInformationUtil;
import com.evolveum.midpoint.schema.statistics.*;
import com.evolveum.midpoint.web.component.AceEditor;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.component.objectdetails.AbstractObjectTabPanel;
import com.evolveum.midpoint.web.page.admin.server.dto.TaskDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationStatsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkBucketManagementPerformanceInformationType;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;

Expand Down Expand Up @@ -86,6 +85,12 @@ private String getStatistics() {
.append(RepositoryPerformanceInformationUtil.format(statistics.getRepositoryPerformanceInformation()))
.append("\n");
}
WorkBucketManagementPerformanceInformationType buckets = statistics.getWorkBucketManagementPerformanceInformation();
if (buckets != null && !buckets.getOperation().isEmpty()) {
sb.append("Work buckets management performance information:\n")
.append(TaskWorkBucketManagementPerformanceInformationUtil.format(buckets))
.append("\n");
}
if (statistics.getCachesPerformanceInformation() != null) {
sb.append("Cache performance information:\n")
.append(CachePerformanceInformationUtil.format(statistics.getCachesPerformanceInformation()))
Expand All @@ -96,6 +101,29 @@ private String getStatistics() {
.append(MethodsPerformanceInformationUtil.format(statistics.getMethodsPerformanceInformation()))
.append("\n");
}

sb.append("\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
sb.append("Other performance-related information that is shown elsewhere (provided here just for completeness):\n\n");
if (statistics.getIterativeTaskInformation() != null) {
sb.append("Iterative task information:\n")
.append(IterativeTaskInformation.format(statistics.getIterativeTaskInformation()))
.append("\n");
}
if (statistics.getActionsExecutedInformation() != null) {
sb.append("Actions executed:\n")
.append(ActionsExecutedInformation.format(statistics.getActionsExecutedInformation()))
.append("\n");
}
// if (statistics.getSynchronizationInformation() != null) {
// sb.append("Synchronization information:\n")
// .append(SynchronizationInformation.format(statistics.getSynchronizationInformation()))
// .append("\n");
// }
if (statistics.getEnvironmentalPerformanceInformation() != null) {
sb.append("Environmental performance information:\n")
.append(EnvironmentalPerformanceInformation.format(statistics.getEnvironmentalPerformanceInformation()))
.append("\n");
}
return sb.toString();
}

Expand Down
Expand Up @@ -258,12 +258,12 @@ public static String format(ActionsExecutedInformationType information) {
private static void formatActionExecuted(StringBuilder sb, ObjectActionsExecutedEntryType a) {
sb.append(String.format(" %-10s %-30s %s\n", a.getOperation(), QNameUtil.getLocalPart(a.getObjectType()), a.getChannel()));
if (a.getTotalSuccessCount() > 0) {
sb.append(String.format(" success: %6d time(s), last: %s (%s, %s) on %tc\n", a.getTotalSuccessCount(),
sb.append(String.format(Locale.US, " success: %6d time(s), last: %s (%s, %s) on %tc\n", a.getTotalSuccessCount(),
a.getLastSuccessObjectName(), a.getLastSuccessObjectDisplayName(), a.getLastSuccessObjectOid(),
XmlTypeConverter.toDate(a.getLastSuccessTimestamp())));
}
if (a.getTotalFailureCount() > 0) {
sb.append(String.format(" failure: %6d time(s), last: %s (%s, %s) on %tc\n", a.getTotalFailureCount(),
sb.append(String.format(Locale.US, " failure: %6d time(s), last: %s (%s, %s) on %tc\n", a.getTotalFailureCount(),
a.getLastFailureObjectName(), a.getLastFailureObjectDisplayName(), a.getLastFailureObjectOid(),
XmlTypeConverter.toDate(a.getLastFailureTimestamp())));
}
Expand Down
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2010-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.schema.statistics;

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

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;

/**
*
*/
public class TaskWorkBucketManagementPerformanceInformationUtil {

public static String format(WorkBucketManagementPerformanceInformationType i) {
StringBuilder sb = new StringBuilder();
List<WorkBucketManagementOperationPerformanceInformationType> operations = new ArrayList<>(i.getOperation());
operations.sort(Comparator.comparing(WorkBucketManagementOperationPerformanceInformationType::getName));
int max = operations.stream().mapToInt(op -> op.getName().length()).max().orElse(0);
for (WorkBucketManagementOperationPerformanceInformationType op : operations) {
long totalTime = or0(op.getTotalTime());
long totalWastedTime = or0(op.getTotalWastedTime());
long totalWaitTime = or0(op.getTotalWaitTime());
int count = or0(op.getCount());
int conflictCount = or0(op.getConflictCount());
int waitCount = or0(op.getBucketWaitCount());
sb.append(String.format(" %-" + (max+2) + "s count:%7d, total time: %s", op.getName()+":", count,
timeInfo(totalTime, op.getMinTime(), op.getMaxTime(), count)));
if (conflictCount > 0 || waitCount > 0) {
sb.append(String.format(Locale.US, ", wasted time for %4d conflict(s): %s (%s)", conflictCount,
timeInfo(totalWastedTime, op.getMinWastedTime(), op.getMaxWastedTime(), count), percent(totalWastedTime, totalTime)));
if (waitCount > 0) {
sb.append(String.format(Locale.US, ", waited %4d time(s): %s (%s)", waitCount,
timeInfo(totalWaitTime, op.getMinWaitTime(), op.getMaxWaitTime(), count), percent(totalWaitTime, totalTime)));
}
}
sb.append("\n");
}
return sb.toString();
}

private static String timeInfo(long total, Long min, Long max, int count) {
return String.format(Locale.US, "%8d ms [min: %5d, max: %5d, avg: %7.1f]", total, or0(min), or0(max),
count > 0 ? (float) total / count : 0);
}

private static String percent(long value, long base) {
if (base != 0) {
return String.format(Locale.US, "%6.2f%%", 100.0 * value / base);
} else if (value == 0) {
return String.format(Locale.US, "%6.2f%%", 0.0);
} else {
return " NaN%";
}
}

private static int or0(Integer n) {
return n != null ? n : 0;
}

private static long or0(Long n) {
return n != null ? n : 0;
}

}

0 comments on commit f56db98

Please sign in to comment.