Revision 943aa6e2 src/eventlog/sequencechartfacade.cc

View differences:

src/eventlog/sequencechartfacade.cc
42 42
    smallestDuration = -1;
43 43
    largestDuration = -1;
44 44

  
45
    maximumOverlapping = -1;
46

  
45 47
    biggestEarliestProcessingTime = 0;
46 48

  
47 49
    biggestEndTimeEvent = NULL;
......
1073 1075

  
1074 1076
}
1075 1077

  
1078
double SequenceChartFacade::getOverlapping(ptr_t eventPtr) {
1079
    long overlapping = 0;
1080
    IEvent* event = (IEvent*) eventPtr;
1081

  
1082
    long eventProcessingTime = event->getEarliestProcessingTime();
1083
    long eventStartTime = event->getEarliestStartTime();
1084

  
1085
    for (IEvent *current = eventLog->getFirstEvent(); current; current = current->getNextEvent()) {
1086

  
1087
        if(current->getComplexity() == 0) {
1088
            continue;
1089
        }
1090

  
1091
        long currentStartTime = current->getEarliestStartTime();
1092
        long currentProcessingTime = current->getEarliestProcessingTime();
1093

  
1094
        if(eventStartTime <= currentStartTime && eventProcessingTime >= currentStartTime) {
1095
            overlapping += eventProcessingTime - currentStartTime;
1096
        } else if (currentStartTime <= eventStartTime && currentProcessingTime >= eventStartTime) {
1097
            overlapping += currentProcessingTime - eventStartTime;
1098
        } else if (currentStartTime <= eventStartTime && currentProcessingTime >= eventProcessingTime) {
1099
            overlapping += event->getComplexity();
1100
        }
1101
    }
1102
    printf("overlapping %i %f %i %i\n", overlapping, overlapping / (event->getComplexity() * 1.0), event->getComplexity(), event->getEventNumber());
1103
    return overlapping / (event->getComplexity() * 1.0);
1104
}
1105

  
1106
double SequenceChartFacade::getMaximumOverlapping() {
1107
    double maxOverlapping = 0;
1108
    for (IEvent *current = eventLog->getFirstEvent(); current; current = current->getNextEvent()) {
1109
        if(!isOnCriticalPath(current) || current->getComplexity() == 0) {
1110
            continue;
1111
        }
1112
        double overlapping = getOverlapping((ptr_t) current);
1113
        if (overlapping > maxOverlapping){
1114
            maxOverlapping = overlapping;
1115
        }
1116
    }
1117
    printf("maxoverlapping %i \n", maxOverlapping);
1118
    return maxOverlapping;
1119
}
1120

  
1121
/*
1122
 * returns the quotient of
1123
 * relative overlapping cputime with the event / maximum relative overlapping
1124
 * cputime with any event of the critical path
1125
 */
1126
double SequenceChartFacade::getOverlappingQuotient(ptr_t eventPtr) {
1127

  
1128
    if (((IEvent*)eventPtr)->getComplexity() == 0) {
1129
        return 0;
1130
    }
1131
    double overlapping = getOverlapping(eventPtr);
1132

  
1133
    if (maximumOverlapping == -1) {
1134
        maximumOverlapping = getMaximumOverlapping();
1135
    }
1136

  
1137
    return overlapping / maximumOverlapping;
1138
}
1139

  

Also available in: Unified diff