Commit 2338867c authored by Simon Tenbusch's avatar Simon Tenbusch

Merge branch 'sequencechart'

Conflicts:
	src/eventlog/ievent.h
	src/eventlog/sequencechartfacade.cc

[sequencechart]
merging sequencechart branch into master branch
parents 14650391 3e29b8a0
......@@ -157,6 +157,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
public final static String IMAGE_JUMP_TO_PREVIOUS_BOTTLENECK = TOOL_IMAGE_DIR + "previousbottleneck.png";
public final static String IMAGE_BOTTLENECK_PREFERENCES = TOOL_IMAGE_DIR + "bottleneckpreferences.png";
public final static String IMAGE_SHOW_CRITICAL_PATH = TOOL_IMAGE_DIR + "criticalpath.png";
public final static String IMAGE_SHOW_CRITICAL_PATH_COLORS = TOOL_IMAGE_DIR + "criticalpath_colors.png";
public final static String IMAGE_INCREASE_SPACING = TOOL_IMAGE_DIR + "incr_spacing.png";
public final static String IMAGE_DECREASE_SPACING = TOOL_IMAGE_DIR + "decr_spacing.png";
public final static String IMAGE_DENSE_AXES = TOOL_IMAGE_DIR + "denseaxes.png";
......@@ -176,6 +177,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
protected SequenceChartAction showEventOverlappingAction;
protected SequenceChartAction showCriticalPathAction;
protected SequenceChartAction showCriticalPathColorsAction;
protected SequenceChartAction previousBottleneckAction;
protected SequenceChartAction nextBottleneckAction;
......@@ -224,6 +226,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
this.showEventNumbersAction = createShowEventNumbersAction();
this.showEventOverlappingAction = createShowEventOverlappingAction();
this.showCriticalPathAction = createShowCriticalPathAction();
this.showCriticalPathColorsAction = createShowCriticalPathColorsAction();
this.previousBottleneckAction = createPreviousBottleneckAction();
this.nextBottleneckAction = createNextBottleneckAction();
this.showBottleneckPreferencesAction = createShowBottleneckPreferencesAction();
......@@ -362,6 +365,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
showHideSubmenu.add(showEventNumbersAction);
showHideSubmenu.add(showEventOverlappingAction);
showHideSubmenu.add(showCriticalPathAction);
showHideSubmenu.add(showCriticalPathColorsAction);
showHideSubmenu.add(showMessageNamesAction);
showHideSubmenu.add(showArrowHeadsAction);
showHideSubmenu.add(showAxisLabelsAction);
......@@ -436,6 +440,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
toolBarManager.add(showEventNumbersAction);
toolBarManager.add(showEventOverlappingAction);
toolBarManager.add(showCriticalPathAction);
toolBarManager.add(showCriticalPathColorsAction);
toolBarManager.add(showMessageNamesAction);
toolBarManager.add(showMessageSendsAction);
toolBarManager.add(showSelfMessagesAction);
......@@ -607,6 +612,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
addSubMenuItem(menu, "Event number", SequenceChart.TimelineMode.EVENT_NUMBER);
addSubMenuItem(menu, "Step", SequenceChart.TimelineMode.STEP);
addSubMenuItem(menu, "Nonlinear", SequenceChart.TimelineMode.NONLINEAR);
addSubMenuItem(menu, "Real Time", SequenceChart.TimelineMode.REAL_TIME);
MenuItem subMenuItem = new MenuItem(menu, SWT.RADIO);
subMenuItem.setText("Custom nonlinear...");
......@@ -630,8 +636,17 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
if (menuItem.getSelection()) {
sequenceChart.setTimelineMode(timelineMode);
timelineModeStatus.update();
if(timelineMode != SequenceChart.TimelineMode.SIMULATION_TIME) {
sequenceChart.setEventLengthMode(SequenceChart.EventLengthMode.NONE);
if(timelineMode != SequenceChart.TimelineMode.SIMULATION_TIME && timelineMode != SequenceChart.TimelineMode.REAL_TIME) {
sequenceChart.setEventLengthMode(SequenceChart.EventLengthMode.NONE);
eventLengthModeAction.update();
}
if (timelineMode == SequenceChart.TimelineMode.REAL_TIME) {
sequenceChart.setEventLengthMode(SequenceChart.EventLengthMode.COMPLEXITY);
eventLengthModeAction.update();
}
if(timelineMode == SequenceChart.TimelineMode.SIMULATION_TIME && sequenceChart.getEventLengthMode() == SequenceChart.EventLengthMode.COMPLEXITY) {
sequenceChart.setEventLengthMode(SequenceChart.EventLengthMode.DURATION);
eventLengthModeAction.update();
}
update();
}
......@@ -729,9 +744,12 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
if (menuItem.getSelection()) {
sequenceChart.setEventLengthMode(eventLengthMode);
if (eventLengthMode != SequenceChart.EventLengthMode.NONE){
if (eventLengthMode == SequenceChart.EventLengthMode.DURATION){
sequenceChart.setTimelineMode(SequenceChart.TimelineMode.SIMULATION_TIME);
timelineModeStatus.update();
} else if (eventLengthMode == SequenceChart.EventLengthMode.COMPLEXITY){
sequenceChart.setTimelineMode(SequenceChart.TimelineMode.REAL_TIME);
timelineModeStatus.update();
}
update();
}
......@@ -931,15 +949,36 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
};
}
private SequenceChartAction createShowCriticalPathColorsAction() {
return new SequenceChartAction("Show Critical Path Colors", Action.AS_CHECK_BOX, SequenceChartPlugin.getImageDescriptor(IMAGE_SHOW_CRITICAL_PATH_COLORS)) {
@Override
protected void doRun() {
sequenceChart.setShowCriticalPathColors(!sequenceChart.getShowCriticalPathColors());
sequenceChart.setShowEventOverlapping(false);
update();
}
@Override
public void update() {
setChecked(sequenceChart.getShowCriticalPathColors());
showEventOverlappingAction.setChecked(sequenceChart.getShowEventOverlapping());
}
@Override
public boolean isEnabled() {
return sequenceChart!=null && !sequenceChart.isLegacyTrace();
}
};
}
private SequenceChartAction createPreviousBottleneckAction() {
return new SequenceChartAction("Jump to previous Bottleneck", Action.AS_PUSH_BUTTON, SequenceChartPlugin.getImageDescriptor(IMAGE_JUMP_TO_PREVIOUS_BOTTLENECK)) {
@Override
protected void doRun() {
sequenceChart.setShowEventOverlapping(true);
/*sequenceChart.setShowEventOverlapping(true);
if (sequenceChart.getEventLengthMode() != SequenceChart.EventLengthMode.NONE){
sequenceChart.setTimelineMode(SequenceChart.TimelineMode.SIMULATION_TIME);
timelineModeStatus.update();
}
}*/
sequenceChart.selectPreviousBottleneck();
}
@Override
......@@ -953,7 +992,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
return new SequenceChartAction("Jump to next Bottleneck", Action.AS_PUSH_BUTTON, SequenceChartPlugin.getImageDescriptor(IMAGE_JUMP_TO_NEXT_BOTTLENECK)) {
@Override
protected void doRun() {
sequenceChart.setShowEventOverlapping(true);
//sequenceChart.setShowEventOverlapping(true);
sequenceChart.selectNextBottleneck();
}
@Override
......@@ -1825,7 +1864,7 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
setHelpAvailable(false);
setTitle("Bottleneck Finder Preferences");
setMessage("Please choose the maximum number of parallel events to be identified as a bottleneck.");
setMessage("Please choose the maximum overlapping coefficient (in %) (0% = no overlapping, 100% = most overlapping).");
Composite container = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
......@@ -1833,12 +1872,12 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
maximumLabel = new Label(container, SWT.NONE);
maximumLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
maximumLabel.setText("Identify Bottlenecks with less or equal than: " + sequenceChart.getBottleneckThreshold() + " events.");
maximumLabel.setText("Identify Bottlenecks on critical path with overlapping coefficient less or equal to: " + (100*sequenceChart.getBottleneckThreshold()) + "%.");
maximum = new Scale(container, SWT.NONE);
maximum.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
maximum.setMinimum(1);
maximum.setMinimum(0);
maximum.setMaximum(100);
maximum.setSelection(sequenceChart.getBottleneckThreshold());
maximum.setSelection((int)(100*sequenceChart.getBottleneckThreshold()));
maximum.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
......@@ -1867,11 +1906,11 @@ public class SequenceChartContributor extends EditorActionBarContributor impleme
}
public void apply() {
sequenceChart.setBottleneckThreshold(maximum.getSelection());
sequenceChart.setBottleneckThreshold(maximum.getSelection()/100.0);
}
public void setMaximumText() {
maximumLabel.setText("Identify Bottlenecks with less or equal than: " + maximum.getSelection() + " events.");
maximumLabel.setText("Identify Bottlenecks on critical path with overlapping coefficient less or equal to: " + (100*sequenceChart.getBottleneckThreshold()) + "%.");
}
......
......@@ -76,7 +76,7 @@ void Event::clearInternalState()
eventLogEntries.clear();
earliestProcessingTime = 0;
_earliestProcessingTime = 0;
}
void Event::synchronize()
......@@ -306,6 +306,24 @@ Event *Event::getNextEvent()
return (Event *)nextEvent;
}
Event *Event::getPreviousEventRealTime()
{
if (eventLog->getFirstEventRealTime() == this) {
return NULL;
}
Assert(previousEventRealTime != NULL);
return (Event*)previousEventRealTime;
}
Event *Event::getNextEventRealTime()
{
if (eventLog->getLastEventRealTime() == this) {
return NULL;
}
Assert(nextEventRealTime != NULL);
return (Event*)nextEventRealTime;
}
Event *Event::getCauseEvent()
{
int causeEventNumber = getCauseEventNumber();
......@@ -438,3 +456,10 @@ Event *Event::getReuserEvent(int &beginSendEntryNumber)
beginSendEntryNumber = -1;
return NULL;
}
long Event::getEarliestProcessingTime() {
return _earliestProcessingTime;
}
long Event::getEarliestStartTime() {
return ((_earliestProcessingTime == 0) ? 0 : _earliestProcessingTime - getComplexity());
}
......@@ -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; }
......@@ -100,6 +100,9 @@ class EVENTLOG_API Event : public IEvent
virtual Event *getPreviousEvent();
virtual Event *getNextEvent();
virtual Event *getPreviousEventRealTime();
virtual Event *getNextEventRealTime();
virtual Event *getCauseEvent();
virtual BeginSendEntry *getCauseBeginSendEntry();
virtual MessageDependency *getCause();
......@@ -108,6 +111,10 @@ class EVENTLOG_API Event : public IEvent
virtual void print(FILE *file = stdout, bool outputEventLogMessages = true);
virtual long getEarliestProcessingTime();
virtual long getEarliestStartTime();
protected:
void deleteAllocatedObjects();
void clearInternalState();
......
......@@ -286,6 +286,18 @@ Event *EventLog::getLastEvent()
return lastEvent;
}
Event *EventLog::getFirstEventRealTime()
{
Assert(firstEventRealTime != NULL);
return firstEventRealTime;
}
Event *EventLog::getLastEventRealTime()
{
Assert(lastEventRealTime != NULL);
return lastEventRealTime;
}
Event *EventLog::getEventForEventNumber(eventnumber_t eventNumber, MatchKind matchKind)
{
Assert(eventNumber >= 0);
......
......@@ -52,6 +52,9 @@ class EVENTLOG_API EventLog : public IEventLog, public EventLogIndex
Event *firstEvent;
Event *lastEvent;
Event *firstEventRealTime;
Event *lastEventRealTime;
bool legacyTrace; // is legacy trace that does not contain EventEndEntries
typedef std::vector<EventLogEntry *> EventLogEntryList;
......@@ -109,6 +112,17 @@ class EVENTLOG_API EventLog : public IEventLog, public EventLogIndex
virtual Event *getFirstEvent();
virtual Event *getLastEvent();
virtual Event *getFirstEventRealTime();
virtual Event *getLastEventRealTime();
virtual void setFirstEventRealTime(Event* e) {
firstEventRealTime = e;;
}
virtual void setLastEventRealTime(Event* e){
lastEventRealTime = e;
}
virtual Event *getNeighbourEvent(IEvent *event, eventnumber_t distance = 1);
virtual Event *getEventForEventNumber(eventnumber_t eventNumber, MatchKind matchKind = EXACT);
virtual Event *getEventForSimulationTime(simtime_t simulationTime, MatchKind matchKind = EXACT);
......
......@@ -103,7 +103,8 @@ enum TimelineMode {
SIMULATION_TIME,
EVENT_NUMBER,
STEP,
NONLINEAR
NONLINEAR,
REAL_TIME
};
NAMESPACE_END
......
......@@ -315,3 +315,9 @@ void FilteredEvent::pushNewFilteredMessageDependency(IMessageDependencyList *mes
messageDependencies->push_back(newMessageDependency);
}
long FilteredEvent::getEarliestProcessingTime() {
return _earliestProcessingTime;
}
long FilteredEvent::getEarliestStartTime() {
return ((_earliestProcessingTime == 0) ? 0 : _earliestProcessingTime - getComplexity());
}
......@@ -95,6 +95,25 @@ class EVENTLOG_API FilteredEvent : public IEvent
virtual FilteredEvent *getPreviousEvent();
virtual FilteredEvent *getNextEvent();
virtual FilteredEvent *getPreviousEventRealTime() {
Assert(false);
return NULL; //Not Supported
}
virtual FilteredEvent *getNextEventRealTime() {
Assert(false);
return NULL;//Not Supported
}
virtual void setNextEventRealTime(IEvent* e) {
nextEventRealTime = e;
}
virtual void setPreviousEventRealTime(IEvent* e) {
previousEventRealTime = e;
}
virtual FilteredEvent *getCauseEvent();
virtual IMessageDependency *getCause();
virtual BeginSendEntry *getCauseBeginSendEntry();
......@@ -108,6 +127,9 @@ class EVENTLOG_API FilteredEvent : public IEvent
void getConsequences(IEvent *event, IMessageDependency *beginMessageDependency, bool isReuse, int level);
int countFilteredMessageDependencies(IMessageDependencyList *messageDependencies);
void pushNewFilteredMessageDependency(IMessageDependencyList *messageDependencies, bool isReuse, IMessageDependency *beginMessageDependency, IMessageDependency *endMessageDependency);
virtual long getEarliestProcessingTime();
virtual long getEarliestStartTime();
};
NAMESPACE_END
......
......@@ -163,6 +163,23 @@ class EVENTLOG_API FilteredEventLog : public IEventLog
virtual bool isEmpty();
virtual FilteredEvent *getFirstEvent();
virtual FilteredEvent *getLastEvent();
virtual Event *getFirstEventRealTime() {
Assert(false);
return NULL;
}
virtual Event *getLastEventRealTime() {
Assert(false);
return NULL;
}
virtual void setFirstEventRealTime(Event* e) {
Assert(false);
}
virtual void setLastEventRealTime(Event* e){
Assert(false);
}
virtual FilteredEvent *getNeighbourEvent(IEvent *event, eventnumber_t distance = 1);
virtual FilteredEvent *getEventForEventNumber(eventnumber_t eventNumber, MatchKind matchKind = EXACT);
virtual FilteredEvent *getEventForSimulationTime(simtime_t simulationTime, MatchKind matchKind = EXACT);
......
......@@ -26,6 +26,7 @@ IEvent::IEvent()
criticalPredecessor = NULL;
cachedTimelineCoordinate = -1;
cachedTimelineCoordinateSystemVersion = -1;
_earliestProcessingTime = 0;
}
int IEvent::findBeginSendEntryIndex(int messageId)
......
......@@ -30,6 +30,9 @@ class EVENTLOG_API IEvent
IEvent *previousEvent;
IEvent *nextEvent;
IEvent *previousEventRealTime;
IEvent *nextEventRealTime;
IEvent* criticalPredecessor;
public:
......@@ -37,7 +40,7 @@ class EVENTLOG_API IEvent
double cachedTimelineCoordinate;
long cachedTimelineCoordinateSystemVersion;
long earliestProcessingTime; //The earliest time the event can be finished, as defined in "A Critical Path Tool for Parallel Simulation Performance Optimization"
long _earliestProcessingTime; //The earliest time the event can be finished, as defined in "A Critical Path Tool for Parallel Simulation Performance Optimization"
......@@ -103,6 +106,23 @@ class EVENTLOG_API IEvent
*/
virtual IEvent *getNextEvent() = 0;
/**
* Returns the immediately preceding event in RealTime or NULL if there is no such event.
*/
virtual IEvent *getPreviousEventRealTime() = 0;
/**
* Returns the immediately following event in RealTime or NULL if there is no such event.
*/
virtual IEvent *getNextEventRealTime() = 0;
virtual void setNextEventRealTime(IEvent* e) {
nextEventRealTime = e;
}
virtual void setPreviousEventRealTime(IEvent* e) {
previousEventRealTime = e;
}
/**
* Returns the closest preceding event which caused this event by sending a message.
*/
......@@ -112,7 +132,9 @@ class EVENTLOG_API IEvent
virtual IMessageDependencyList *getCauses() = 0;
virtual IMessageDependencyList *getConsequences() = 0;
/**
/** public int getEarliestProcessingTime() {
return EventLogEngineJNI.IEvent_earliestProcessingTime_get(swigCPtr, this);
}
* Print all entries of this event.
*/
virtual void print(FILE *file = stdout, bool outputEventLogMessages = true) = 0;
......@@ -146,6 +168,9 @@ class EVENTLOG_API IEvent
static void linkEvents(IEvent *previousEvent, IEvent *nextEvent);
static void unlinkEvents(IEvent *previousEvent, IEvent *nextEvent);
virtual long getEarliestProcessingTime() = 0;
virtual long getEarliestStartTime() = 0;
IEvent* getCriticalPredecessor() {
return criticalPredecessor;
}
......@@ -153,7 +178,6 @@ class EVENTLOG_API IEvent
void setCriticalPredecessor(IEvent* e) {
criticalPredecessor = e;
}
};
NAMESPACE_END
......
......@@ -135,6 +135,17 @@ class EVENTLOG_API IEventLog
* Returns the last event or NULL if the log is empty.
*/
virtual IEvent *getLastEvent() = 0;
/**
* Returns the first event in RealTime or NULL if the log is empty.
*/
virtual IEvent *getFirstEventRealTime() = 0;
/**
* Returns the last event in RealTime or NULL if the log is empty.
*/
virtual IEvent *getLastEventRealTime() = 0;
virtual void setFirstEventRealTime(Event* e) = 0;
virtual void setLastEventRealTime(Event* e) = 0;
/**
* Returns the requested event or NULL if there is no such event included in the log.
* The given event number may not be included in the log.
......
This diff is collapsed.
......@@ -39,6 +39,7 @@ class EVENTLOG_API SequenceChartFacade : public EventLogFacade
long timelineCoordinateSystemVersion;
eventnumber_t timelineCoordinateOriginEventNumber;
simtime_t timelineCoordinateOriginSimulationTime;
double timelineCoordinateOriginRealTime;
eventnumber_t timelineCoordinateRangeStartEventNumber;
eventnumber_t timelineCoordinateRangeEndEventNumber;
TimelineMode timelineMode;
......@@ -48,9 +49,16 @@ class EVENTLOG_API SequenceChartFacade : public EventLogFacade
long smallestComplexity;
long largestComplexity;
double maximumOverlapping;
simtime_t smallestDuration;
simtime_t largestDuration;
simtime_t biggestEarliestProcessingTime;
IEvent* biggestEarliestProcessingTimeEvent;
IEvent* biggestEndTimeEvent;
std::set<ptr_t> cachedParallelSet;
IEvent* lastSelected;
......@@ -109,19 +117,28 @@ class EVENTLOG_API SequenceChartFacade : public EventLogFacade
*/
simtime_t getLargestEventDuration();
double getOverlappingQuotient(ptr_t eventPtr);
/*
* returns true when the events overlap in the REAL_TIME domain (i.e. are executed on two cpus in parallel)
*/
bool isOverlappingInRealTimeDomain(ptr_t eventPtr1, ptr_t eventPtr2);
/*
* Returns whether an event not part of a set of parallel events with more than treshold elements.
*/
bool isBottleneck(IEvent* event, unsigned int threshold);
bool isBottleneck(IEvent* event, double threshold);
bool isParallelWithEvent(IEvent* event, IEvent* selected);
IEvent* getPreviousBottleneck(IEvent* e, unsigned int threshold);
IEvent* getNextBottleneck(IEvent* e, unsigned int threshold);
IEvent* getPreviousBottleneck(IEvent* e, double threshold);
IEvent* getNextBottleneck(IEvent* e, double threshold);
bool isOnCriticalPath(IEvent* event);
ptr_t getLargestEndtimeInEventRange(ptr_t startEventPtr, ptr_t endEventPtr, bool duration=false);
/**
* Timeline coordinate can be given in the range (-infinity, +infinity).
* Simulation time will be in the range [0, lastEventSimulationTime].
......@@ -155,6 +172,14 @@ class EVENTLOG_API SequenceChartFacade : public EventLogFacade
simtime_t getSmallestParallelEndtime(IEvent* event);
void calculateCriticalPath();
void cacheRealTimeEventOrder();
double getOverlapping(ptr_t eventPtr);
double getMaximumOverlapping();
};
NAMESPACE_END
......
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