Search in sources :

Example 1 with ActivityPerformanceInformation

use of com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation in project midpoint by Evolveum.

the class TestSystemPerformance method recordProgress.

private void recordProgress(String label, Task task) {
    Long start = task.getLastRunStartTimestamp();
    long progress = task.getLegacyProgress();
    if (start == null || progress == lastProgress) {
        return;
    }
    lastProgress = progress;
    progressOutputFile.recordProgress(label, task);
    OperationStatsType stats = task.getStoredOperationStatsOrClone();
    logger.info("\n{}", TaskOperationStatsUtil.format(stats));
    // TODO remove fake result + remove getting the task!
    OperationResult tempResult = new OperationResult("temp");
    TreeNode<ActivityPerformanceInformation> performanceInformation;
    try {
        performanceInformation = activityManager.getPerformanceInformation(task.getOid(), tempResult);
    } catch (CommonException e) {
        throw new SystemException(e);
    }
    displayDumpable("performance: " + label + task.getName(), performanceInformation);
}
Also used : SystemException(com.evolveum.midpoint.util.exception.SystemException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException) ActivityPerformanceInformation(com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)

Example 2 with ActivityPerformanceInformation

use of com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation in project midpoint by Evolveum.

the class StatisticsLogger method logItemCompletion.

public void logItemCompletion(Operation operation, OperationResultStatus resultStatus) {
    long end = operation.getEndTimeMillis();
    TransientActivityRunStatistics current = activityRun.getTransientRunStatistics();
    ActivityPerformanceInformation overall = getOverallStatistics();
    String mainMessage = String.format(Locale.US, "%s of %s%s done with status %s in %,1f ms.", activityRun.getShortName(), operation.getIterationItemInformation(), activityRun.getContextDescriptionSpaced(), resultStatus, operation.getDurationRounded());
    String counts = String.format(Locale.US, " Items processed in current run: %,d (%,d overall), errors: %,d (%,d overall).", current.getItemsProcessed(), overall.getItemsProcessed(), current.getErrors(), overall.getErrors());
    String throughput;
    Double overallThroughput = overall.getThroughput();
    if (overallThroughput != null) {
        throughput = String.format(Locale.US, " Overall throughput: %,.1f items per minute.", overallThroughput);
    } else {
        throughput = "";
    }
    String mainMessageAddition = counts + throughput;
    String fullStats = getFullStatMessage(overall, end);
    log(ActivityReportingDefinition::getItemCompletionLogging, mainMessage, mainMessageAddition, fullStats);
}
Also used : ActivityReportingDefinition(com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition) ActivityPerformanceInformation(com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)

Example 3 with ActivityPerformanceInformation

use of com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation in project midpoint by Evolveum.

the class StatisticsLogger method logBucketCompletion.

void logBucketCompletion(boolean complete) {
    TransientActivityRunStatistics current = activityRun.getTransientRunStatistics();
    long end = System.currentTimeMillis();
    ActivityPerformanceInformation overall = getOverallStatistics();
    RunningTask task = activityRun.getRunningTask();
    String mainMessage = String.format("%s bucket #%d for %s (%s in %s).%s", complete ? "Completed" : "Partially processed", activityRun.getBucket().getSequentialNumber(), activityRun.getShortNameUncapitalized(), activityRun.getActivityPath().toDebugName(), task, complete ? "" : " Bucket processing was interrupted.");
    String currentBrief = String.format(Locale.US, "Current run: processed %,d objects in %.1f seconds, got %,d errors.", current.getItemsProcessed(), current.getWallClockTime(end) / 1000.0, current.getErrors());
    if (current.getItemsProcessed() > 0) {
        currentBrief += String.format(Locale.US, " Average processing time for one object: %,.1f milliseconds. " + "Wall clock average: %,.1f milliseconds, throughput: %,.1f items per minute.", current.getAverageTime(), current.getAverageWallClockTime(end), current.getThroughput(end));
    }
    Long wallClockTime = overall.getWallClockTime();
    // Wall-clock time information is not available e.g. for activities with persistent state (like LiveSync)
    boolean hasWallClockTime = wallClockTime != null && wallClockTime > 0;
    String wallClockTimeString;
    if (hasWallClockTime) {
        wallClockTimeString = String.format(Locale.US, " in %.1f seconds", ActivityItemProcessingStatisticsUtil.toSeconds(wallClockTime));
    } else {
        wallClockTimeString = "";
    }
    String overallBrief = String.format(Locale.US, "Overall: processed %,d objects%s, got %,d errors. Real progress: %,d.", overall.getItemsProcessed(), wallClockTimeString, overall.getErrors(), overall.getProgress());
    if (overall.getItemsProcessed() > 0) {
        overallBrief += String.format(Locale.US, " Average processing time for one object: %,.1f milliseconds.", overall.getAverageTime());
        if (hasWallClockTime && overall.getAverageWallClockTime() != null) {
            overallBrief += String.format(Locale.US, " Wall clock average: %,.1f milliseconds, throughput: %,.1f items per minute.", overall.getAverageWallClockTime(), overall.getThroughput());
        }
    }
    String mainMessageAddition = "\n" + currentBrief + "\n" + overallBrief;
    String fullStats = getFullStatMessage(overall, end);
    log(ActivityReportingDefinition::getBucketCompletionLogging, mainMessage, mainMessageAddition, fullStats);
}
Also used : ActivityReportingDefinition(com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition) RunningTask(com.evolveum.midpoint.task.api.RunningTask) ActivityPerformanceInformation(com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)

Aggregations

ActivityPerformanceInformation (com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)3 ActivityReportingDefinition (com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 RunningTask (com.evolveum.midpoint.task.api.RunningTask)1 CommonException (com.evolveum.midpoint.util.exception.CommonException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1