Revision 2595f1a9

View differences:

ide/org.omnetpp.sequencechart/src/org/omnetpp/sequencechart/widgets/SequenceChart.java
353 353
		setupListeners();
354 354
		
355 355
		parallelSelectionUpdater = new ParallelSelectionUpdater(this);
356
		
356 357
	}
357 358

  
358 359
    private void setupHoverSupport() {
......
2530 2531
			/*long longestEventOffset = getPixelLength(sequenceChartFacade.getLargestEventDuration());
2531 2532
			System.out.println(longestEventOffset);
2532 2533
			*/
2533
			long longestEventOffset = 0; //TODO: Make this work to fix error with long events getting not displayed even when they are visible.
2534
			long[] eventPtrRange = getFirstLastEventPtrForViewportRange(Rectangle.SINGLETON.x - (extraClipping+longestEventOffset), Rectangle.SINGLETON.right() + extraClipping);
2534
			//long longestEventOffset = 0; //TODO: Make this work to fix error with long events getting not displayed even when they are visible.
2535
			//long[] eventPtrRange = getFirstLastEventPtrForViewportRange(Rectangle.SINGLETON.x - (extraClipping+longestEventOffset), Rectangle.SINGLETON.right() + extraClipping);
2536
			long[] eventPtrRange = getFirstLastEventPtrForViewportRange(0, Rectangle.SINGLETON.right() + extraClipping);
2537
			
2535 2538
			long startEventPtr = eventPtrRange[0];
2536 2539
			long endEventPtr = eventPtrRange[1];
2537 2540

  
......
3986 3989
    			if (lastEvent != null) {
3987 3990
    				BigDecimal endSimulationTime;
3988 3991
    				if (getTimelineMode() == TimelineMode.REAL_TIME){
3989
    					//TODO cache this
3990 3992
    					lastEvent = sequenceChartFacade.IEvent_getEvent(sequenceChartFacade.getLargestEndtimeInEventRange(eventLog.getFirstEvent().getCPtr(),eventLog.getLastEvent().getCPtr()));
3991
    					endSimulationTime = lastEvent == null ? BigDecimal.ZERO : new BigDecimal(lastEvent.getEarliestProcessingTime()/1000000.0);
3993
    					endSimulationTime = lastEvent == null ? BigDecimal.ZERO : new BigDecimal(lastEvent.getEarliestProcessingTime()/1000000);
3992 3994
    				} else if (getEventLengthMode() == EventLengthMode.DURATION){
3993 3995
    					endSimulationTime = lastEvent == null ? BigDecimal.ZERO : lastEvent.getSimulationTime().toBigDecimal().add(lastEvent.getEventEntry().getDuration().toBigDecimal());
3994 3996
    				} else {
src/eventlog/sequencechartfacade.cc
42 42
    smallestDuration = -1;
43 43
    largestDuration = -1;
44 44

  
45
    biggestEarliestProcessingTime = 0;
46

  
45 47
    cachedParallelSet.clear();
46 48
    cachedCriticalPath.clear();
47 49
}
......
452 454
    {
453 455
        case REAL_TIME:
454 456
        {
455
            simtime_t lastEventSimulationTime = (eventLog->getLastEvent()->getEarliestStartTime())/1000000.0;
456
            //NOTE: This sometimes crashes the Sequencechart because the returned value might be too big
457
            simulationTime = max(BigDecimal::Zero, min(lastEventSimulationTime, (timelineCoordinate + timelineCoordinateOriginRealTime)));
457
            simulationTime = max(BigDecimal::Zero, min(biggestEarliestProcessingTime, (timelineCoordinate + timelineCoordinateOriginRealTime)));
458 458
        }
459 459
        break;
460 460
        case SIMULATION_TIME:
......
976 976
    }
977 977
    //Now produce the convex hull of critical antecessors/predecessors:
978 978
    cachedCriticalPath.clear();
979
    //Cache largest processing time:
980
    biggestEarliestProcessingTime = maxEarliestProcessingTime / 1000000.0;
981
    biggestEarliestProcessingTimeEvent = maxEarliestProcessingTimeEvent;
979 982
    for (IEvent *predecessor = maxEarliestProcessingTimeEvent; predecessor ; predecessor = predecessor->getCriticalPredecessor()) {
980 983
        cachedCriticalPath.insert((ptr_t)predecessor);
981 984
        if(predecessor->getEventNumber() == 0) {
......
983 986
        }
984 987
    }
985 988
}
986

  
989
/*
990
 * Returns the event with the largest calculated earliest Processing time in REAL_TIME mode
991
 * or the largest endtime in other modes within the given event range.
992
 */
987 993
ptr_t SequenceChartFacade::getLargestEndtimeInEventRange(ptr_t startEventPtr, ptr_t endEventPtr) {
988 994
    IEvent *startEvent = (IEvent *)startEventPtr;
989 995
    IEvent *endEvent = (IEvent *)endEventPtr;
......
991 997
    {
992 998
    case REAL_TIME:
993 999
    {
1000
        //Use cached result when range contains all events
1001
        if(startEvent == eventLog->getFirstEvent() && endEvent == eventLog->getLastEvent()) {
1002
            return (ptr_t)biggestEarliestProcessingTimeEvent;
1003
        }
1004

  
994 1005
        long largest = 0;
995 1006
        IEvent* largestEvent = startEvent;
996 1007

  
src/eventlog/sequencechartfacade.h
52 52
        simtime_t smallestDuration;
53 53
        simtime_t largestDuration;
54 54

  
55
        simtime_t biggestEarliestProcessingTime;
56
        IEvent* biggestEarliestProcessingTimeEvent;
57

  
55 58
        std::set<ptr_t> cachedParallelSet;
56 59
        IEvent* lastSelected;
57 60

  

Also available in: Unified diff