Revision 17a06e54

View differences:

ide/org.omnetpp.sequencechart/src/org/omnetpp/sequencechart/widgets/SequenceChart.java
2985 2985
			
2986 2986
		} else { //showEventOverlapping:
2987 2987
			graphics.setForegroundColor(EVENT_BORDER_COLOR);
2988
			if (isParallelWithSelection(eventPtr)) {
2989
				graphics.setBackgroundColor(OVERLAPPING_EVENT_BACKGROUND_COLOR);
2990
			} else {
2991
				graphics.setBackgroundColor(NON_OVERLAPPING_EVENT_BACKGROUND_COLOR);
2988
			switch (getTimelineMode()) {
2989
			case REAL_TIME:
2990
				if (isOverlappingRealTimeWithSelection(eventPtr)) {
2991
					graphics.setBackgroundColor(OVERLAPPING_EVENT_BACKGROUND_COLOR);
2992
				} else {
2993
					graphics.setBackgroundColor(NON_OVERLAPPING_EVENT_BACKGROUND_COLOR);
2994
				}
2995
				break;
2996
			default:
2997
				if (isParallelWithSelection(eventPtr)) {
2998
					graphics.setBackgroundColor(OVERLAPPING_EVENT_BACKGROUND_COLOR);
2999
				} else {
3000
					graphics.setBackgroundColor(NON_OVERLAPPING_EVENT_BACKGROUND_COLOR);
3001
				}
2992 3002
			}
2993 3003
		}
2994 3004
	}
2995 3005
	
3006
	private boolean isOverlappingRealTimeWithSelection(long eventPtr) {
3007
		if (selectionEventNumbers.isEmpty()) {
3008
			return false;
3009
		}
3010
		
3011
		IEvent selected = eventLog.getEventForEventNumber(selectionEventNumbers.get(0));
3012
		
3013
		if (selected.getEventNumber()==0) {
3014
			return false; //Exclude Event 0 (management event)
3015
		}
3016
		if(isLegacyTrace()) {
3017
			return false; //Legacy: no duration
3018
		}
3019
		
3020
		return sequenceChartFacade.isOverlappingInRealTimeDomain(eventPtr, selected.getCPtr());
3021
	}
3022

  
2996 3023
	/**
2997 3024
	 * Draws a single event at the given coordinates and axis module.
2998 3025
	 */
src/eventlog/sequencechartfacade.cc
1099 1099
            overlapping += event->getComplexity();
1100 1100
        }
1101 1101
    }
1102
    printf("overlapping %i %f %i %i\n", overlapping, overlapping / (event->getComplexity() * 1.0), event->getComplexity(), event->getEventNumber());
1103 1102
    return overlapping / (event->getComplexity() * 1.0);
1104 1103
}
1105 1104

  
......
1114 1113
            maxOverlapping = overlapping;
1115 1114
        }
1116 1115
    }
1117
    printf("maxoverlapping %i \n", maxOverlapping);
1118 1116
    return maxOverlapping;
1119 1117
}
1120 1118

  
......
1137 1135
    return overlapping / maximumOverlapping;
1138 1136
}
1139 1137

  
1138
bool SequenceChartFacade::isOverlappingInRealTimeDomain(ptr_t eventPtr1, ptr_t eventPtr2) {
1139
    long eventProcessingTime1 = ((IEvent*)eventPtr1)->getEarliestProcessingTime();
1140
    long eventStartTime1 = ((IEvent*)eventPtr1)->getEarliestStartTime();
1141
    long eventProcessingTime2 = ((IEvent*)eventPtr2)->getEarliestProcessingTime();
1142
    long eventStartTime2 = ((IEvent*)eventPtr2)->getEarliestStartTime();
1143

  
1144
    return !(eventProcessingTime1 < eventStartTime2 || eventProcessingTime2 < eventStartTime1);
1145
}
src/eventlog/sequencechartfacade.h
119 119

  
120 120
        double getOverlappingQuotient(ptr_t eventPtr);
121 121

  
122
        /*
123
         * returns true when the events overlap in the REAL_TIME domain (i.e. are executed on two cpus in parallel)
124
         */
125
        bool isOverlappingInRealTimeDomain(ptr_t eventPtr1, ptr_t eventPtr2);
126

  
122 127

  
123 128
        /*
124 129
        * Returns whether an event not part of a set of parallel events with more than treshold elements.

Also available in: Unified diff