Commit 7c7d95e5 authored by Simon Tenbusch's avatar Simon Tenbusch

[sequencechart]

- fixing hopefully last bugs with the new event order: events are drawn correctly and now, only those events are drawn that are actually visible
parent f270c074
......@@ -2581,7 +2581,6 @@ public class SequenceChart
//long longestEventOffset = 0; //TODO: Make this work to fix error with long events getting not displayed even when they are visible.
//long[] eventPtrRange = getFirstLastEventPtrForViewportRange(Rectangle.SINGLETON.x - (extraClipping+longestEventOffset), Rectangle.SINGLETON.right() + extraClipping);
long[] eventPtrRange = getFirstLastEventPtrForViewportRange(0, Rectangle.SINGLETON.right() + extraClipping);
long startEventPtr = eventPtrRange[0];
long endEventPtr = eventPtrRange[1];
if (showZeroSimulationTimeRegions)
......@@ -2792,7 +2791,6 @@ public class SequenceChart
if (startEventPtr != 0 && endEventPtr != 0) {
if (debug)
Debug.println("Drawing events with event range: " + sequenceChartFacade.IEvent_getEventNumber(startEventPtr) + " ->: " + sequenceChartFacade.IEvent_getEventNumber(endEventPtr));
//HashMap<Integer, Integer> axisYtoLastX = new HashMap<Integer, Integer>();
// NOTE: navigating through next event takes care about leaving events out which are not in the filter's result
......@@ -2803,11 +2801,10 @@ public class SequenceChart
int x = (int)getEventXViewportCoordinate(eventPtr);
int y = getEventYViewportCoordinate(eventPtr);
// Integer lastX = axisYtoLastX.get(y);
// performance optimization: don't draw event if there's one already drawn exactly there
//if (lastX == null || lastX.intValue() != x) {
//axisYtoLastX.put(y, x);
drawEvent(graphics, eventPtr, getEventAxisModuleIndex(eventPtr), x, y);
drawEvent(graphics, eventPtr, getEventAxisModuleIndex(eventPtr), x, y);
//}
}
......@@ -2908,10 +2905,6 @@ public class SequenceChart
private long getNextEventPtrAccordingToTimelineMode(long eventPtr) {
IEvent e = sequenceChartFacade.IEvent_getEvent(eventPtr);
if (e == null) {
System.out.println("nullpointer!");
}
e = getNextEventAccordingToTimelineMode(e);
if (e == null) {
return 0;
......@@ -3981,18 +3974,16 @@ public class SequenceChart
if (eventLog == null || eventLog.isEmpty() || eventLog.getApproximateNumberOfEvents() == 0)
return new long[] {0, 0};
else {
//TODO: speed this up
//Fix for REAL_TIME Visualization:
//In this mode, events are not necessarily ordered in event number order so
//Fix for REAL_TIME Visualization (not necessary anymore):
//In this mode, events are not ne cessarily ordered in event number order so
//that an interval of visible events may not be correct.
//fix it by just returning the interval of all events.
if (getTimelineMode() == TimelineMode.REAL_TIME){
/*if (getTimelineMode() == TimelineMode.REAL_TIME){
return new long[] { eventLog.getFirstEventRealTime().getCPtr(), eventLog.getLastEventRealTime().getCPtr() };
}
}*/
double leftTimelineCoordinate = getTimelineCoordinateForViewportCoordinate(x1);
double rightTimelineCoordinate = getTimelineCoordinateForViewportCoordinate(x2);
IEvent startEvent = sequenceChartFacade.getLastEventNotAfterTimelineCoordinate(leftTimelineCoordinate);
if (startEvent == null) {
if (getTimelineMode() == TimelineMode.REAL_TIME) {
......
......@@ -88,7 +88,7 @@ class EVENTLOG_API Event : public IEvent
virtual eventnumber_t getEventNumber() { return eventEntry->eventNumber; }
virtual simtime_t getSimulationTime() { return eventEntry->simulationTime; }
virtual long getComplexity() { return !eventEndEntry ? 1 : eventEndEntry->complexity; }
virtual long getComplexity() { return !eventEndEntry ? 0 : eventEndEntry->complexity; }
virtual int getModuleId() { return eventEntry->moduleId; }
virtual long getMessageId() { return eventEntry->messageId; }
virtual eventnumber_t getCauseEventNumber() { return eventEntry->causeEventNumber; }
......
......@@ -26,6 +26,7 @@ IEvent::IEvent()
criticalPredecessor = NULL;
cachedTimelineCoordinate = -1;
cachedTimelineCoordinateSystemVersion = -1;
_earliestProcessingTime = 0;
}
int IEvent::findBeginSendEntryIndex(int messageId)
......
......@@ -321,7 +321,7 @@ IEvent *SequenceChartFacade::getLastEventNotAfterTimelineCoordinate(double timel
{
IEvent* res = eventLog->getFirstEventRealTime();
for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
if ((double) current->getEarliestProcessingTime() / 1000000.0 < timelineCoordinate) {
if ((double) current->getEarliestProcessingTime() / 1000000.0 < timelineCoordinate + timelineCoordinateOriginRealTime) {
if (current->getEarliestProcessingTime() > res->getEarliestProcessingTime()) {
res = current;
}
......@@ -366,8 +366,8 @@ IEvent *SequenceChartFacade::getFirstEventNotBeforeTimelineCoordinate(double tim
case REAL_TIME:
{
IEvent* res = eventLog->getLastEventRealTime();
for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
if ((double) current->getEarliestStartTime() / 1000000.0 > timelineCoordinate) {
for (IEvent *current = eventLog->getLastEventRealTime(); current; current = current->getPreviousEventRealTime()) {
if ((double) current->getEarliestStartTime() / 1000000.0 > timelineCoordinate + timelineCoordinateOriginRealTime) {
if (current->getEarliestStartTime() < res->getEarliestStartTime()) {
res = current;
}
......@@ -961,7 +961,6 @@ void SequenceChartFacade::calculateCriticalPath() {
if(current->getEventEndEntry()) {
current->_earliestProcessingTime = current->getComplexity();
}
printf("%i \n", current->getEventNumber());
current->setCriticalPredecessor(eventLog->getFirstEvent());
for (IEvent *antecessor = eventLog->getFirstEvent(); antecessor; antecessor = antecessor->getNextEvent()) {
if(antecessor==current) {
......@@ -1156,7 +1155,7 @@ bool SequenceChartFacade::isOverlappingInRealTimeDomain(ptr_t eventPtr1, ptr_t e
bool compare_events_realtime (IEvent* a, IEvent* b)
{
return a->getEarliestStartTime() <= b->getEarliestStartTime();
return (a->getEarliestStartTime() < b->getEarliestStartTime() || (a->getEarliestStartTime() == b->getEarliestStartTime() && a->getEventNumber() < b->getEventNumber()));
}
......@@ -1184,9 +1183,10 @@ void SequenceChartFacade::cacheRealTimeEventOrder() {
//Set last event in eventlog
eventLog->setLastEventRealTime((Event*)prev);
//Test:
/*
for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
printf("event %i, simtime %f, time %i \n",current->getEventNumber(), current->getSimulationTime().dbl(), current->getEarliestStartTime());
}
}*/
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment