Revision 50468190

View differences:

ide/org.omnetpp.sequencechart/src/org/omnetpp/sequencechart/editors/SequenceChartContributor.java
974 974
		return new SequenceChartAction("Jump to previous Bottleneck", Action.AS_PUSH_BUTTON, SequenceChartPlugin.getImageDescriptor(IMAGE_JUMP_TO_PREVIOUS_BOTTLENECK)) {
975 975
			@Override
976 976
			protected void doRun() {
977
				sequenceChart.setShowEventOverlapping(true);
977
				/*sequenceChart.setShowEventOverlapping(true);
978 978
			    if (sequenceChart.getEventLengthMode() != SequenceChart.EventLengthMode.NONE){
979 979
			    	sequenceChart.setTimelineMode(SequenceChart.TimelineMode.SIMULATION_TIME);
980 980
					timelineModeStatus.update();
981
			    }
981
			    }*/
982 982
				sequenceChart.selectPreviousBottleneck();
983 983
			}
984 984
			@Override
......
992 992
		return new SequenceChartAction("Jump to next Bottleneck", Action.AS_PUSH_BUTTON, SequenceChartPlugin.getImageDescriptor(IMAGE_JUMP_TO_NEXT_BOTTLENECK)) {
993 993
			@Override
994 994
			protected void doRun() {
995
				sequenceChart.setShowEventOverlapping(true);
995
				//sequenceChart.setShowEventOverlapping(true);
996 996
				sequenceChart.selectNextBottleneck();
997 997
			}
998 998
			@Override
......
1864 1864

  
1865 1865
        	setHelpAvailable(false);
1866 1866
        	setTitle("Bottleneck Finder Preferences");
1867
        	setMessage("Please choose the maximum number of parallel events to be identified as a bottleneck.");
1867
        	setMessage("Please choose the maximum overlapping coefficient (in %) (0% = no overlapping, 100% = most overlapping).");
1868 1868

  
1869 1869
        	Composite container = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
1870 1870
        	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
......
1872 1872

  
1873 1873
        	maximumLabel = new Label(container, SWT.NONE);
1874 1874
        	maximumLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
1875
        	maximumLabel.setText("Identify Bottlenecks with less or equal than: " + sequenceChart.getBottleneckThreshold() + " events.");
1875
        	maximumLabel.setText("Identify Bottlenecks on critical path with overlapping coefficient less or equal to: " + (100*sequenceChart.getBottleneckThreshold()) + "%.");
1876 1876
        	maximum = new Scale(container, SWT.NONE);
1877 1877
        	maximum.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
1878
        	maximum.setMinimum(1);
1878
        	maximum.setMinimum(0);
1879 1879
        	maximum.setMaximum(100);
1880
        	maximum.setSelection(sequenceChart.getBottleneckThreshold());
1880
        	maximum.setSelection((int)(100*sequenceChart.getBottleneckThreshold()));
1881 1881
        	maximum.addSelectionListener(new SelectionAdapter() {
1882 1882
        		@Override
1883 1883
        		public void widgetSelected(SelectionEvent e) {
......
1906 1906
        }
1907 1907

  
1908 1908
        public void apply() {
1909
        	sequenceChart.setBottleneckThreshold(maximum.getSelection());
1909
        	sequenceChart.setBottleneckThreshold(maximum.getSelection()/100.0);
1910 1910
        }
1911 1911
        
1912 1912
        public void setMaximumText() {
1913
        	maximumLabel.setText("Identify Bottlenecks with less or equal than: " + maximum.getSelection() + " events.");
1913
        	maximumLabel.setText("Identify Bottlenecks on critical path with overlapping coefficient less or equal to: " + (100*sequenceChart.getBottleneckThreshold()) + "%.");
1914 1914

  
1915 1915
        }
1916 1916

  
ide/org.omnetpp.sequencechart/src/org/omnetpp/sequencechart/widgets/SequenceChart.java
20 20
import java.util.Map;
21 21
import java.util.Set;
22 22

  
23
import org.apache.batik.bridge.Viewport;
23 24
import org.eclipse.core.resources.IMarker;
24 25
import org.eclipse.core.resources.IResource;
25 26
import org.eclipse.core.runtime.Assert;
......
226 227
    private boolean showAxesWithoutEvents = false;
227 228
    private boolean showTransmissionDurations = true;
228 229
    
229
    private int bottleneckThreshold = 2;
230
    private double bottleneckThreshold = 0.5;
230 231

  
231 232
    private AxisOrderingMode axisOrderingMode = AxisOrderingMode.MODULE_ID; // specifies the ordering mode of axes
232 233

  
......
772 773
	 */
773 774
	public void setTimelineMode(TimelineMode timelineMode) {
774 775
	    org.omnetpp.common.engine.BigDecimal[] leftRightSimulationTimes = null;
775

  
776
	//    boolean domainSwitch = (timelineMode==TimelineMode.REAL_TIME || getTimelineMode()==TimelineMode.REAL_TIME); 
776 777
	    if(timelineMode==TimelineMode.REAL_TIME) {
777 778
	    	//Trigger initialization of earliest starting times 
778 779
	    	sequenceChartFacade.isOnCriticalPath(null);
779 780
	    }
780 781
	    
781
	    if (!eventLog.isEmpty())
782
	        leftRightSimulationTimes = getViewportSimulationTimeRange();
783 782

  
783
	    //TODO FIX this later (correct zooming behaviour on timeline domain switch)
784
	    /*if (domainSwitch && getTimelineMode() != TimelineMode.REAL_TIME) {	
785
	    	IEvent rightEvent = sequenceChartFacade.getLastEventNotAfterTimelineCoordinate(getTimelineCoordinateForViewportCoordinate(getViewportRight()));
786
	    	IEvent leftEvent = sequenceChartFacade.getFirstEventNotBeforeTimelineCoordinate(getTimelineCoordinateForViewportCoordinate(getViewportLeft()));
787
	    	leftRightSimulationTimes[0] = new org.omnetpp.common.engine.BigDecimal(leftEvent.get_earliestProcessingTime()-leftEvent.getComplexity());
788
	    	leftRightSimulationTimes[1] = new org.omnetpp.common.engine.BigDecimal(rightEvent.get_earliestProcessingTime());  
789
	    }*/
790
	    
791
	    if (!eventLog.isEmpty()) {
792
	        leftRightSimulationTimes = getViewportSimulationTimeRange();
793
	    }
794
	    
784 795
	    sequenceChartFacade.setTimelineMode(timelineMode.ordinal());
785

  
796
	    
786 797
	    if (!eventLog.isEmpty())
787 798
	        setViewportSimulationTimeRange(leftRightSimulationTimes);
788 799
	}
......
5121 5132
		return eventLog.isLegacyTrace();
5122 5133
	}
5123 5134
	
5124
	public int getBottleneckThreshold() {
5135
	public double getBottleneckThreshold() {
5125 5136
		return bottleneckThreshold;
5126 5137
	}
5127 5138
	
5128
	public void setBottleneckThreshold(int t) {
5139
	public void setBottleneckThreshold(double t) {
5129 5140
		bottleneckThreshold = t;
5130 5141
	}
5131 5142
	
src/eventlog/sequencechartfacade.cc
783 783
}
784 784

  
785 785

  
786
IEvent* SequenceChartFacade::getPreviousBottleneck(IEvent* e, unsigned int threshold) {
786
IEvent* SequenceChartFacade::getPreviousBottleneck(IEvent* e, double threshold) {
787 787
    IEvent* next = e->getPreviousEvent();
788 788
    while (next) {
789 789
        if (isBottleneck(next,threshold)) {
......
794 794
    return e;
795 795
}
796 796

  
797
IEvent* SequenceChartFacade::getNextBottleneck(IEvent* e, unsigned int threshold) {
797
IEvent* SequenceChartFacade::getNextBottleneck(IEvent* e, double threshold) {
798 798
    IEvent* next = e->getNextEvent();
799 799
    while (next) {
800 800
        if (isBottleneck(next,threshold)) {
......
808 808
/*
809 809
 * Returns whether an event not part of a set of parallel events with more than treshold elements.
810 810
 */
811
bool SequenceChartFacade::isBottleneck(IEvent* event, unsigned int threshold)
811
bool SequenceChartFacade::isBottleneck(IEvent* event, double threshold)
812 812
{
813
    return getLargestParallelSetSize(event) <= threshold;
813
    if (isOnCriticalPath(event)) {
814
        return getOverlappingQuotient((ptr_t)event) <= threshold;
815
    }
816
    return false;
814 817
}
815 818
/*
816 819
 * Returns whether event is in the largest parallel set of selected.
src/eventlog/sequencechartfacade.h
128 128
        /*
129 129
        * Returns whether an event not part of a set of parallel events with more than treshold elements.
130 130
        */
131
        bool isBottleneck(IEvent* event, unsigned int threshold);
131
        bool isBottleneck(IEvent* event, double threshold);
132 132

  
133 133
        bool isParallelWithEvent(IEvent* event, IEvent* selected);
134 134

  
135
        IEvent* getPreviousBottleneck(IEvent* e, unsigned int threshold);
136
        IEvent* getNextBottleneck(IEvent* e, unsigned int threshold);
135
        IEvent* getPreviousBottleneck(IEvent* e, double threshold);
136
        IEvent* getNextBottleneck(IEvent* e, double threshold);
137 137

  
138 138
        bool isOnCriticalPath(IEvent* event);
139 139

  

Also available in: Unified diff