Search in sources :

Example 1 with MappingsStatisticsEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType in project midpoint by Evolveum.

the class EnvironmentalPerformanceInformation method addMappingsTo.

private static void addMappingsTo(EnvironmentalPerformanceInformationType rv, MappingsStatisticsType delta) {
    if (delta == null) {
        return;
    }
    if (rv.getMappingsStatistics() == null) {
        rv.setMappingsStatistics(delta.clone());
        return;
    }
    MappingsStatisticsType rvMST = rv.getMappingsStatistics();
    for (MappingsStatisticsEntryType de : delta.getEntry()) {
        String object = de.getObject();
        MappingsStatisticsEntryType e = findMappingsEntryType(rvMST.getEntry(), object);
        if (e == null) {
            e = new MappingsStatisticsEntryType();
            e.setObject(object);
            rvMST.getEntry().add(e);
        }
        e.setCount(e.getCount() + de.getCount());
        e.setMinTime(min(e.getMinTime(), de.getMinTime()));
        e.setMaxTime(max(e.getMaxTime(), de.getMaxTime()));
        e.setTotalTime(e.getTotalTime() + de.getTotalTime());
        if (e.getCount() > 0) {
            e.setAverageTime(e.getTotalTime() / e.getCount());
        } else {
            e.setAverageTime(null);
        }
    }
}
Also used : MappingsStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsType) MappingsStatisticsEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType)

Example 2 with MappingsStatisticsEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType in project midpoint by Evolveum.

the class EnvironmentalPerformanceInformation method toMappingsStatisticsType.

private MappingsStatisticsType toMappingsStatisticsType() {
    final MappingsStatisticsType rv = new MappingsStatisticsType();
    if (mappingsData == null) {
        return rv;
    }
    final Map<String, Integer> entriesPerType = new HashMap<>();
    for (MappingsStatisticsKey key : mappingsData.keySet()) {
        Integer current = entriesPerType.get(key.getObjectType());
        entriesPerType.put(key.getObjectType(), current != null ? current + 1 : 1);
    }
    for (Map.Entry<MappingsStatisticsKey, GenericStatisticsData> entry : mappingsData.entrySet()) {
        final MappingsStatisticsKey key = entry.getKey();
        final String targetEntryName;
        if (entriesPerType.get(key.getObjectType()) < AGGREGATION_THRESHOLD) {
            targetEntryName = key.getObjectName();
        } else {
            targetEntryName = key.getObjectType() + " (aggregated)";
        }
        MappingsStatisticsEntryType entryType = findMappingsEntryType(rv.getEntry(), targetEntryName);
        if (entryType == null) {
            entryType = new MappingsStatisticsEntryType();
            entryType.setObject(targetEntryName);
            rv.getEntry().add(entryType);
        }
        setValueMapping(entryType, entry.getValue().getCount(), entry.getValue().getMinDuration(), entry.getValue().getMaxDuration(), entry.getValue().getTotalDuration());
    }
    return rv;
}
Also used : MappingsStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsType) HashMap(java.util.HashMap) MappingsStatisticsEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MappingsStatisticsEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType)2 MappingsStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsType)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1