You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(24) |
Sep
(14) |
Oct
(13) |
Nov
(5) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(2) |
Feb
(53) |
Mar
(29) |
Apr
(5) |
May
(11) |
Jun
(3) |
Jul
(7) |
Aug
(48) |
Sep
(10) |
Oct
(8) |
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(2) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mar...@us...> - 2007-11-07 03:40:37
|
Revision: 78 http://gridsim.svn.sourceforge.net/gridsim/?rev=78&view=rev Author: marcos_dias Date: 2007-11-06 19:40:40 -0800 (Tue, 06 Nov 2007) Log Message: ----------- This update contains a small improvement: + All the resource windows show the same time span, which makes the visualisation and debugging processes easier. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java Added Paths: ----------- branches/gridsim4.0-branch3/source/gridsim/gui/GUISettings.java Modified: branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-11-05 01:07:03 UTC (rev 77) +++ branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-11-07 03:40:40 UTC (rev 78) @@ -99,6 +99,9 @@ private HashMap<String, ResourceWindow> resourceWindows_ = null; private ArrayList<GridResource> resources_ = null; + // the GUISettings object used to store settings of windows + private static GUISettings settings_ = GUISettings.getInstance(); + // a list of all the allocation listeners in the system private static LinkedHashMap<Integer, AllocationListener> listeners_; @@ -317,6 +320,7 @@ * simulation time */ private static void informListenersAboutTime() { + settings_.setTimeSpan(GridSim.clock()); Iterator<AllocationListener> iterListener = listeners_.values().iterator(); while(iterListener.hasNext()) { AllocationListener listener = iterListener.next(); Added: branches/gridsim4.0-branch3/source/gridsim/gui/GUISettings.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GUISettings.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GUISettings.java 2007-11-07 03:40:40 UTC (rev 78) @@ -0,0 +1,57 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package gridsim.gui; + +/** + * This class stores settings shared by all the windows of the graphical + * user interface. + * + * @author Marcos Dias de Assuncao + */ + +public class GUISettings { + + // the time span used by the windows + private double timeSpan = 200; + private static GUISettings settingsInstance_ = null; + + /** + * Returns the single instance of the {@link GUISettings} + * object, creating it if it has not already been instantiated. + * @return the InterGridParameters instance. + */ + public static synchronized GUISettings getInstance() { + if( settingsInstance_ == null) + settingsInstance_ = new GUISettings(); + + return settingsInstance_; + } + + /** + * Gets the time span for the GUI components + * @return the time span for the GUI components + */ + public double getTimeSpan() { + return timeSpan; + } + + /** + * Sets the time span for the GUI components + * @param timeSpan the time span for the GUI components + * @return <tt>true</tt> if the time span has been updated + * or <tt>false</tt> otherwise. + */ + public boolean setTimeSpan(double timeSpan) { + if(timeSpan > this.timeSpan) { + this.timeSpan = timeSpan; + return true; + } + else + return false; + } +} Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-11-05 01:07:03 UTC (rev 77) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-11-07 03:40:40 UTC (rev 78) @@ -123,7 +123,6 @@ private JScrollPane scroller_; private DrawingPanel drawingPanel_; private long currentTime_; - private double timeSpan_ = 200; // the panel that shows the list of gridlets or advance reservations private ItemPanel itemPanel_; @@ -133,6 +132,9 @@ // time unit used to display information on the screen private int timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND; + + // the settings object + private GUISettings settings_; private static final int WINDOW_WIDTH = 1100; private static final int WINDOW_HEIGHT = 300; @@ -148,6 +150,7 @@ public ResourceWindow(GridResource resource, int windowId) { resource_ = resource; numPE_ = resource_.getResourceCharacteristics().getNumPE(); + settings_ = GUISettings.getInstance(); // sets layout to null as the components are resized // by a component adaptor triggered by resizing the window @@ -185,6 +188,7 @@ public boolean allocationActionPerformed(AllocationAction action) { int type = action.getActionType(); LinkedList<ScheduleItem> list = action.getScheduleItems(); + long previousTime = currentTime_; currentTime_ = (long) GridSim.clock(); switch(type){ @@ -200,7 +204,7 @@ for(ScheduleItem item : list){ scheduledItems_.add(item); double finishTime = item.getFinishTime(); - updateTimeSpan(finishTime); + settings_.setTimeSpan(finishTime); itemPanel_.updateItem(item); } updateResourceWindow(); @@ -215,7 +219,7 @@ break; case AllocationAction.SIMULATION_TIME_CHANGED: - if(updateTimeSpan(currentTime_)) + if(currentTime_ > previousTime) updateResourceWindow(); break; @@ -366,18 +370,6 @@ (int)(super.getMaximumSize().height))); } - /** - * Updates the time span, that is, the time frame shown in the window - */ - private boolean updateTimeSpan(double time) { - if(time > timeSpan_) { - timeSpan_ = time; - return true; - } - else - return false; - } - private void updateResourceWindow(){ drawingPanel_.repaint(); } @@ -475,24 +467,27 @@ } protected synchronized void paintComponent(Graphics g2) { + super.paintComponent(g2); Graphics2D g2D = (Graphics2D)g2; g2D.setFont(graphFont_); + + double timeSpan = settings_.getTimeSpan(); panelHeight_ = leftPanel_.getHeight() - 100 - SHIFT_Y - SHIFT_BOTTOM; panelWidth_ = leftPanel_.getWidth() - 50 - 2 * SHIFT_X; scaleY_ = panelHeight_ / (float) numPE_; - scaleX_ = panelWidth_ / (float) (timeSpan_); + scaleX_ = panelWidth_ / (float) (timeSpan); scaleY_ = scaleY_ * sliderY_.getValue() * (float) 0.1; scaleX_ = scaleX_ * sliderX_.getValue() * (float) 0.1; - super.setPreferredSize(new Dimension((int) (timeSpan_ * scaleX_) + 2 * SHIFT_X, + super.setPreferredSize(new Dimension((int) (timeSpan * scaleX_) + 2 * SHIFT_X, (int) ((numPE_) * scaleY_) + SHIFT_Y + SHIFT_BOTTOM)); drawSchedulingQueue(g2D); - drawGridsAndAxes(g2D); + drawGridsAndAxes(timeSpan, g2D); super.revalidate(); } @@ -501,7 +496,7 @@ * @param timeSpan the time span of the simulation * @param g2D the graphics 2D context */ - private void drawGridsAndAxes(Graphics2D g2D) { + private void drawGridsAndAxes(double timeSpan, Graphics2D g2D) { String text = null; g2D.setColor(timeGridColor_); @@ -511,7 +506,7 @@ g2D.setComposite(transpComp_); int heightGph = (int)(numPE_ * scaleY_); - int widthGph = (int) (timeSpan_ * scaleX_); + int widthGph = (int) (timeSpan * scaleX_); int x, y; for(int i=0; i<=widthGph; i+=50) { @@ -542,7 +537,7 @@ g2D.drawString(text, SHIFT_X + (int)(currentTime_ * scaleX_) - (text.length() * 5), SHIFT_Y - 10); - text = "Time Span: " + (int)(convertTime(timeSpan_)); + text = "Time Span: " + (int)(convertTime(timeSpan)); y = SHIFT_Y + (text.length() * 6); x = widthGph + SHIFT_X + 15; g2D.rotate(-1.571, x, y); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-11-05 01:07:01
|
Revision: 77 http://gridsim.svn.sourceforge.net/gridsim/?rev=77&view=rev Author: marcos_dias Date: 2007-11-04 17:07:03 -0800 (Sun, 04 Nov 2007) Log Message: ----------- This update contains some small bug fixes and changes in names of some classes. Modified Paths: -------------- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java Added Paths: ----------- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java Removed Paths: ------------- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java Modified: branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-11-05 01:07:03 UTC (rev 77) @@ -13,7 +13,7 @@ import gridsim.GridletList; import gridsim.turbo.Reservation; import gridsim.turbo.ReservationRequester; -import gridsim.turbo.TimeSlotList; +import gridsim.turbo.AvailabilityInfo; import java.util.ArrayList; import java.util.Calendar; @@ -180,7 +180,7 @@ resName = (String) resNameList.get(val); // queries the availability of the Grid resource - TimeSlotList availability = + AvailabilityInfo availability = super.queryFreeTime(GridSim.clock(), Integer.MAX_VALUE, resID); System.out.println("Availability information returned by the " + Modified: branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2007-11-05 01:07:03 UTC (rev 77) @@ -10,14 +10,10 @@ package gridsim; import java.util.Calendar; -import java.util.LinkedList; import eduni.simjava.Sim_entity; import eduni.simjava.Sim_event; import eduni.simjava.Sim_port; -import gridsim.gui.AllocationAction; -import gridsim.gui.DefaultGridSimVisualizer; -import gridsim.turbo.ScheduleItem; /** * AllocPolicy is an abstract class that handles the internal Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-11-05 01:07:03 UTC (rev 77) @@ -787,7 +787,7 @@ * @param item the item whose information has to be updated */ protected void updateItem(ScheduleItem item) { - int position = getPosition(item.getID(), item.getUserID(), + int position = getPosition(item.getID(), item.getSenderID(), item.isAdvanceReservation()); if(position < 0) { @@ -877,7 +877,7 @@ */ private String itemSummary(ScheduleItem item) { return (item.isAdvanceReservation() ? "Res. " : "Grl. ") + "ID: " + item.getID() + - ", User: " + item.getUserID(); + ", User: " + item.getSenderID(); } /** @@ -902,7 +902,7 @@ for (int i = 0; i < sizeVector; i++) { item = items_.get(i); if (item.getID() == itemId - && item.getUserID() == userId + && item.getSenderID() == userId && item.isAdvanceReservation() == ar) return i; } @@ -933,7 +933,7 @@ if(submittedTime == item.getSubmissionTime() && insertItem.getID() == item.getID() && insertItem.isAdvanceReservation() == item.isAdvanceReservation() - && insertItem.getUserID() == item.getUserID() ) { + && insertItem.getSenderID() == item.getSenderID() ) { return i; } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-11-05 01:07:03 UTC (rev 77) @@ -32,7 +32,7 @@ // by informing the reservation requester when resource will be available to // fulfil the reservation. This attribute contains the list of PEs // available at a set of simulation times - private TimeSlotList resOptions_; + private AvailabilityInfo resOptions_; // the price associate with this message private double price_; @@ -383,7 +383,7 @@ * Gets the reservation options given by the Grid resource * @return the reservation options */ - public TimeSlotList getReservationOptions() { + public AvailabilityInfo getReservationOptions() { return resOptions_; } @@ -391,7 +391,7 @@ * Sets the reservation options given by the Grid resource * @param resOptions the reservation options object */ - public void setReservationOptions(TimeSlotList resOptions) { + public void setReservationOptions(AvailabilityInfo resOptions) { resOptions_ = resOptions; } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-11-05 01:07:03 UTC (rev 77) @@ -140,13 +140,13 @@ // internal event tags used by this gridlet // a tag to denote expiry time - private final int EXPIRY_TIME = 12; + private static final int EXPIRY_TIME = 12; // a tag to indicate that a reservation has to start - private final int START_RESERVATION = 13; + private static final int START_RESERVATION = 13; // a tag to indicate that a reservation has to finish - private final int FINISH_RESERVATION = 14; + private static final int FINISH_RESERVATION = 14; // a tag to indicate that a gridlet has finished private static final int GRIDLET_FINISHED = 10; @@ -630,7 +630,7 @@ * Handles a query free time request. * @param message the advance reservation message received. */ - public void handleQueryFreeTime(ARMessage message) { + public void handleQueryAvailability(ARMessage message) { // gets the reservation id of the message Reservation reservation = message.getReservation(); @@ -643,7 +643,7 @@ int duration = reservation.getDurationTime(); // gets the availability information from the availability profile - TimeSlotList availability = getAvailabilityInfo(startTime, duration); + AvailabilityInfo availability = getAvailabilityInfo(startTime, duration); // sets the options as the availability over the requested period response.setReservationOptions(availability); @@ -2298,9 +2298,9 @@ * entries that correspond to the availability profile between the times * specified by the requester. */ - private TimeSlotList getAvailabilityInfo(double startTime, int duration) { + private AvailabilityInfo getAvailabilityInfo(double startTime, int duration) { - TimeSlotList list = new TimeSlotList(); + AvailabilityInfo list = new AvailabilityInfo(); int anchorIndex = -1; // if the user specified the start time as 0, it means that the @@ -2319,7 +2319,7 @@ // a pointer to the anchor entry (described above) AvailabilityProfileEntry anchorEntry = null; int length = availProfile_.size(); - TimeSlotEntry firstEntry = null; + AvailabilityInfoEntry firstEntry = null; double entryTime; @@ -2340,15 +2340,17 @@ // before the first entry of the profile, so the intersection list // has to start with the ranges of PEs currently available if (anchorEntry == null) { + PERangeList peList = (resource_.getFreePERanges() == null) ? null : + resource_.getFreePERanges().clone(); firstEntry = - new TimeSlotEntry(startTime, resource_.getFreePERanges().clone()); + new AvailabilityInfoEntry(startTime, peList); } else { PERangeList newList = anchorEntry.getPERanges(); if(newList != null) { newList = newList.clone(); } - firstEntry = new TimeSlotEntry(startTime, newList); + firstEntry = new AvailabilityInfoEntry(startTime, newList); anchorIndex = availProfile_.indexOf(anchorEntry); } @@ -2369,14 +2371,15 @@ if(peList != null) { peList = peList.clone(); } - TimeSlotEntry tsEntry = - new TimeSlotEntry(nextEntry.getTime(), peList.clone()); + AvailabilityInfoEntry tsEntry = + new AvailabilityInfoEntry(nextEntry.getTime(), peList); list.add(tsEntry); } previousEntry = nextEntry; } } + list.sort(); // sort the list before send it back return list; } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java 2007-11-05 01:07:03 UTC (rev 77) @@ -172,6 +172,8 @@ */ private void initARPolicy() throws Exception { try{ + arPolicy_ = (ARTPolicy)super.policy_; + if(arPolicy_ == null && policyType_ == TResourceCharacteristics.AR_PARALLEL_SPACE_SHARED) { arPolicy_ = (ARParallelSpaceShared)policy_; @@ -263,7 +265,7 @@ break; case ARMessage.TYPE_AR_LIST_FREE_TIME: - arPolicy_.handleQueryFreeTime(message); + arPolicy_.handleQueryAvailability(message); break; } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2007-11-05 01:07:03 UTC (rev 77) @@ -109,7 +109,7 @@ * @param message the advance reservation message received * @pre message != null */ - public abstract void handleQueryFreeTime(ARMessage message); + public abstract void handleQueryAvailability(ARMessage message); //-------------------- END OF ABSTRACT METHODS -------------------- Copied: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java (from rev 76, branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java) =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java 2007-11-05 01:07:03 UTC (rev 77) @@ -0,0 +1,312 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package gridsim.turbo; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; + +/** + * The {@link AvailabilityInfo} class represents a list of entries + * that represent the availability of PES of a Grid resource over + * a period of time. This is used in return to a query availability + * in an advance reservation based allocation policy. + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see ARTPolicy + * @see PERange + * @see PERangeList + * @see ARParallelSpaceShared + * @see ARParallelSpaceShared#handleQueryAvailability(ARMessage) + */ + +public class AvailabilityInfo { + + private static final long serialVersionUID = -3951650752024908016L; + + private ArrayList<AvailabilityInfoEntry> list_; + private double startTime_; + private double finishTime_; + + private static final int UNKNOWN = -1; + + /** + * Default constructor. + */ + public AvailabilityInfo() { + list_ = new ArrayList<AvailabilityInfoEntry>(); + startTime_ = UNKNOWN; + finishTime_ = UNKNOWN; + } + + /** + * Returns the start time of this list. That is, + * the time of the first element of this list + * @return the start time + */ + public double getStartTime() { + return startTime_; + } + + /** + * Returns the end time of this list. + * @return the end time + */ + public double getEndTime() { + return finishTime_; + } + + /** + * Sets the start time of this list. + * @param startTime the start time + */ + public void setStartTime(double startTime) { + startTime_ = startTime; + } + + /** + * Sets the end time of this list. + * @param finishTime the end time + */ + public void setFinishTime(double finishTime) { + finishTime_ = finishTime; + } + + /** + * Adds the specified element to this list. + * @param entry the entry to be added to this list + * @return <tt>true + */ + public boolean add(AvailabilityInfoEntry entry) { + if(entry == null) { + return false; + } + else { + list_.add(entry); + } + return true; + } + + /** + * Sorts the entries of this availability info object. + */ + public void sort() { + Collections.sort(list_); + } + + /** + * Adds all of the elements in the specified Collection to this list, + * The behaviour of this operation is undefined if the specified + * Collection is modified while the operation is in progress. + * (This implies that the behaviour of this call is undefined if the + * specified Collection is this list, and this list is nonempty.) + * @param collection the collection to be included in this list + * @return <tt>true<tt> if the collection has been added successfully + * or <tt>false</tt> otherwise. + */ + public boolean addAll(Collection<? extends AvailabilityInfoEntry> collection) { + boolean result = true; + + // adds the collection to the list and sets the start + // and finish time again + if(collection != null && !collection.isEmpty()) { + list_.addAll(collection); + } + return result; + } + + /** + * Removes all elements from the list. + */ + public void clear() { + list_.clear(); + } + + /** + * Returns a shallow copy of this list. + * (The elements themselves are not copied.) + */ + public Object clone() { + return list_.clone(); + } + + /** + * Returns <tt>true</tt> if this list contains the specified element. + * @param entry the entry whose presence in this List is to be tested. + * @return <tt>true</tt> if the specified element is present; + * <tt>false</tt> otherwise. + */ + public boolean contains(Object entry) { + return list_.contains(entry); + } + + /** + * Returns the element at the specified position in this list. + * @param index the index of the element to return + * @return the element at the specified position in this list. + */ + public AvailabilityInfoEntry get(int index) { + return list_.get(index); + } + + /** + * Searches for the first occurence of the given argument, + * testing for equality using the equals method. + * @param entry the entry whose index is to be returned + * @return the index of the first occurrence of the argument + * in this list; returns <tt>-1</tt> if the object is not found. + */ + public int indexOf(Object entry) { + return list_.indexOf(entry); + } + + /** + * Tests if this list has no elements. + * @return <tt>true</tt> if the list has no elements. + */ + public boolean isEmpty() { + return list_.isEmpty(); + } + + /** + * Returns an iterator over the elements in this list in proper sequence. + * @return the iterator. + */ + public Iterator<AvailabilityInfoEntry> iterator() { + return list_.iterator(); + } + + /** + * Removes the element at a given index + * @param index the index of the element to be removed + * @return the removed element. + */ + public AvailabilityInfoEntry remove(int index) { + return list_.remove(index); + } + + /** + * Removes a given element from the list. + * @param entry the entry to be removed + * @return <tt>true</tt> if the collection contained the + * specified entry. + */ + public boolean remove(Object entry) { + return list_.remove(entry); + } + + /** + * Returns the size of this list. + * @return the size of this list + */ + public int size() { + return list_.size(); + } + + /** + * Scans the entries in a list and returns the first time frame over + * which a request with the characteristics provided can be scheduled + * @param duration the duration of the request + * @param reqPE the number of PEs required + * @return the start time or <tt>-1</tt> if not found + */ + public double getPotentialStartTime(int duration, int reqPE) { + + // the anchor index, the entry in the profile where + // the request would be placed OR the closest entry to the + // point where the anchor of the request would be placed + int anchorIndex = -1; + + // a pointer to the anchor entry (described above) + AvailabilityInfoEntry anchorEntry = null; + + // the list of selected ranges + PERangeList intersectList = null; + + double potStartTime = -1; // keep the potential start time of the request + double potFinishTime = -1; // store the gridlet's expected finish time + + intersectList = null; + int length = list_.size(); + + Iterator<AvailabilityInfoEntry> iterProfile = list_.iterator(); + while(iterProfile.hasNext()) { + + AvailabilityInfoEntry entry = iterProfile.next(); + anchorEntry = entry; + anchorIndex = list_.indexOf(anchorEntry); + + // sets the start time as the time of the entry + potStartTime = entry.getTime(); + // calculates when the finish time will be if + // the gridlet is put at this position + potFinishTime = potStartTime + duration; + + // scan the profile until an entry with enough PEs is found + if(entry.getNumPE() < reqPE) { + continue; + } + else { + // if an entry with enough PEs is found, then scan the list + // from that point onwards analysing the intersection of + // the ranges available in the entries until the + // request expected completion time + intersectList = entry.getAvailRanges().clone(); + + // Look for the intersection of available ranges from + // the anchor until the end of the profile or until + // the entries are further than the expected completion time + for(int i=anchorIndex+1; i<length; i++){ + AvailabilityInfoEntry nextEntry = list_.get(i); + if(nextEntry.getTime() > potFinishTime){ + break; + } + else{ + // if the finish time is equals to the entry time, so there + // is no need to check the intersection + if(nextEntry.getTime() < potFinishTime) { + intersectList = PERangeList.intersection(intersectList, + nextEntry.getAvailRanges()); + if(intersectList == null || intersectList.getNumPE() < reqPE) { + break; + } + } + } + } + // If a time slot with enough PEs has been found, then stop the search + if(intersectList != null && intersectList.getNumPE() >= reqPE) { + break; + } + } + } + + // if the potential finish time is larger than the end time of + // this list, then the request cannot be scheduled + if(potFinishTime > finishTime_) { + potStartTime = UNKNOWN; + } + + return potStartTime; + } + + /** + * Creates a string representation of the list + * @return a string representation + */ + public String toString() { + String result = "Availability={\n"; + for(AvailabilityInfoEntry entry : list_){ + result += entry + "\n"; + } + result += "}"; + return result; + } +} Copied: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java (from rev 76, branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java) =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java 2007-11-05 01:07:03 UTC (rev 77) @@ -0,0 +1,129 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package gridsim.turbo; + +/** + * The {@link AvailabilityInfoEntry} class represents an entry in a list of + * time slots available, which can be allocated to a user. This is used + * in return to a query for free time slots in an advance reservation + * based allocation policy. + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see ARTPolicy + * @see PERange + * @see PERangeList + * @see AvailabilityInfo + * @see ARParallelSpaceShared + * @see ARParallelSpaceShared#handleQueryAvailability(ARMessage) + */ + +public class AvailabilityInfoEntry implements Comparable <AvailabilityInfoEntry> { + + private double time_; + private PERangeList availRanges_; + + /** + * Creates a new instance of {@link AvailabilityInfoEntry} + * @param time the time associated with this entry + */ + public AvailabilityInfoEntry(double time) { + time_ = time; + availRanges_ = null; + } + + /** + * Creates a new instance of {@link AvailabilityInfoEntry} + * @param time the time associated with this entry + * @param ranges the list of ranges of PEs available + */ + public AvailabilityInfoEntry(double time, PERangeList ranges) { + time_ = time; + availRanges_ = ranges; + } + + /** + * Gets the time associated with this entry + * @return the time associated with this entry + */ + public double getTime() { + return time_; + } + + /** + * Sets the time associated with this entry + * @param time the time associated with this entry + * @return <tt>true</tt> if the time has been set successfully or + * <tt>false</tt> otherwise. + */ + public boolean setTime(double time) { + if(time < 0) + return false; + + time_ = time; + return true; + } + + /** + * Returns the list of ranges available at this entry + * @return the list of ranges available + */ + public PERangeList getAvailRanges() { + return availRanges_; + } + + /** + * Sets the ranges of PEs available at this entry + * @param availRanges the list of ranges of PEs available + */ + public void setAvailRanges(PERangeList availRanges) { + availRanges_ = availRanges; + } + + /** + * Compares this object with the specified object for order. + * Returns a negative integer, zero, or a positive integer + * as this object is less than, equal to, or greater + * than the specified object. + * @param entry the entry to be compared. + * @return a negative integer, zero, or a positive integer as + * this entry is less than, equal to, or greater + * than the specified entry. + */ + public int compareTo(AvailabilityInfoEntry entry) { + int result = 0; + if(time_ < entry.time_) { + result = -1; + } + else if(time_ > entry.time_) { + result = 1; + } + return result; + } + + /** + * Gets the number of PEs associated with this entry + * @return the number of PEs + */ + public int getNumPE() { + if(availRanges_ == null) + return 0; + else + return availRanges_.getNumPE(); + } + + /** + * Creates a string representation of this entry + * @return a representation of this entry + */ + public String toString() { + return "{time="+ time_ + "; " + + ( (availRanges_!=null) ? availRanges_ : "{[]}") + "}"; + } +} Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-11-05 01:07:03 UTC (rev 77) @@ -314,7 +314,7 @@ * @pre startTime >= 0 * @pre finishTime > 0 */ - public TimeSlotList queryFreeTime(double startTime, + public AvailabilityInfo queryFreeTime(double startTime, int duration, int resID) { // check all the values first @@ -323,7 +323,7 @@ return null; } - TimeSlotList resOptions = null; + AvailabilityInfo resOptions = null; try { // create the reservation itself Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-11-05 01:07:03 UTC (rev 77) @@ -162,7 +162,7 @@ * @pre $none * @post $none */ - public int getUserID() { + public int getSenderID() { return gridlet_.getUserID(); } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-11-05 01:07:03 UTC (rev 77) @@ -235,7 +235,7 @@ * @pre $none * @post $none */ - public int getUserID() { + public int getSenderID() { if(reservation_==null) return UNKNOWN; @@ -342,7 +342,7 @@ public String toString(int timeUnit) { String unitDesc = getTimeDescr(timeUnit); String result = "Reservation ID: " + reservation_.getID() + "\n" + - "User ID: " + getUserID() + "\n" + + "User ID: " + getSenderID() + "\n" + "Status: " + Reservation.getStatusString(reservation_.getStatus()) + "\n" + "Sub. Time: " + decFormater_.format(convertTime(getSubmissionTime(), timeUnit)) + " " + unitDesc + "\n" + Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-11-05 01:07:03 UTC (rev 77) @@ -36,10 +36,10 @@ int getID(); /** - * Returns the id of the user that created this item + * Returns the id of the entity that created this item * @return the user id */ - int getUserID(); + int getSenderID(); /** * Returns the status of this item Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-11-05 01:07:03 UTC (rev 77) @@ -111,7 +111,7 @@ // Need to check against the userId as well since each user // might have same Gridlet id submitted to the same GridResource - if (rgl.getID()==gridletId && rgl.getUserID()==userId) { + if (rgl.getID()==gridletId && rgl.getSenderID()==userId) { return rgl; } } Deleted: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-11-05 01:07:03 UTC (rev 77) @@ -1,129 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - */ - -package gridsim.turbo; - -/** - * The {@link TimeSlotEntry} class represents an entry in a list of - * time slots available, which can be allocated to a user. This is used - * in return to a query for free time slots in an advance reservation - * based allocation policy. - * - * @author Marcos Dias de Assuncao - * @since GridSim Turbo Alpha 0.1 - * - * @see ARTPolicy - * @see PERange - * @see PERangeList - * @see TimeSlotList - * @see ARParallelSpaceShared - * @see ARParallelSpaceShared#handleQueryFreeTime(ARMessage) - */ - -public class TimeSlotEntry implements Comparable <TimeSlotEntry> { - - private double time_; - private PERangeList availRanges_; - - /** - * Creates a new instance of {@link TimeSlotEntry} - * @param time the time associated with this entry - */ - public TimeSlotEntry(double time) { - time_ = time; - availRanges_ = null; - } - - /** - * Creates a new instance of {@link TimeSlotEntry} - * @param time the time associated with this entry - * @param ranges the list of ranges of PEs available - */ - public TimeSlotEntry(double time, PERangeList ranges) { - time_ = time; - availRanges_ = ranges; - } - - /** - * Gets the time associated with this entry - * @return the time associated with this entry - */ - public double getTime() { - return time_; - } - - /** - * Sets the time associated with this entry - * @param time the time associated with this entry - * @return <tt>true</tt> if the time has been set successfully or - * <tt>false</tt> otherwise. - */ - public boolean setTime(double time) { - if(time < 0) - return false; - - time_ = time; - return true; - } - - /** - * Returns the list of ranges available at this entry - * @return the list of ranges available - */ - public PERangeList getAvailRanges() { - return availRanges_; - } - - /** - * Sets the ranges of PEs available at this entry - * @param availRanges the list of ranges of PEs available - */ - public void setAvailRanges(PERangeList availRanges) { - availRanges_ = availRanges; - } - - /** - * Compares this object with the specified object for order. - * Returns a negative integer, zero, or a positive integer - * as this object is less than, equal to, or greater - * than the specified object. - * @param entry the entry to be compared. - * @return a negative integer, zero, or a positive integer as - * this entry is less than, equal to, or greater - * than the specified entry. - */ - public int compareTo(TimeSlotEntry entry) { - int result = 0; - if(time_ < entry.time_) { - result = -1; - } - else if(time_ > entry.time_) { - result = 1; - } - return result; - } - - /** - * Gets the number of PEs associated with this entry - * @return the number of PEs - */ - public int getNumPE() { - if(availRanges_ == null) - return 0; - else - return availRanges_.getNumPE(); - } - - /** - * Creates a string representation of this entry - * @return a representation of this entry - */ - public String toString() { - return "{time="+ time_ + "; " - + ( (availRanges_!=null) ? availRanges_ : "{[]}") + "}"; - } -} Deleted: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-10-31 03:45:23 UTC (rev 76) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-11-05 01:07:03 UTC (rev 77) @@ -1,314 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - */ - -package gridsim.turbo; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -/** - * The {@link TimeSlotList} class represents a list of time slots - * that are available and can be allocated to a user. This is used - * in return to a query for free time slots in an advance reservation - * based allocation policy. - * - * @author Marcos Dias de Assuncao - * @since GridSim Turbo Alpha 0.1 - * - * @see ARTPolicy - * @see PERange - * @see PERangeList - * @see ARParallelSpaceShared - * @see ARParallelSpaceShared#handleQueryFreeTime(ARMessage) - */ - -public class TimeSlotList { - - private static final long serialVersionUID = -3951650752024908016L; - - private ArrayList<TimeSlotEntry> list_; - private double startTime_; - private double finishTime_; - - private static final int UNKNOWN = -1; - - /** - * Default constructor. - */ - public TimeSlotList() { - list_ = new ArrayList<TimeSlotEntry>(); - startTime_ = UNKNOWN; - finishTime_ = UNKNOWN; - } - - /** - * Returns the start time of this list. That is, - * the time of the first element of this list - * @return the start time - */ - public double getStartTime() { - return startTime_; - } - - /** - * Returns the end time of this list. - * @return the end time - */ - public double getEndTime() { - return finishTime_; - } - - /** - * Sets the start time of this list. - * @param startTime the start time - */ - public void setStartTime(double startTime) { - startTime_ = startTime; - } - - /** - * Sets the end time of this list. - * @param finishTime the end time - */ - public void setFinishTime(double finishTime) { - finishTime_ = finishTime; - } - - /** - * Adds the specified element to this list. - * @param entry the entry to be added to this list - * @return <tt>true - */ - public boolean add(TimeSlotEntry entry) { - if(entry == null) { - return false; - } - else { - double entryTime = entry.getTime(); - int size = list_.size(); - int index = 0; - for (index=0; index<size; index++) { - if(list_.get(index).getTime() > entryTime) { - break; - } - } - list_.add(index, entry); - } - return true; - } - - /** - * Adds all of the elements in the specified Collection to this list, - * The behaviour of this operation is undefined if the specified - * Collection is modified while the operation is in progress. - * (This implies that the behaviour of this call is undefined if the - * specified Collection is this list, and this list is nonempty.) - * @param collection the collection to be included in this list - * @return <tt>true<tt> if the collection has been added successfully - * or <tt>false</tt> otherwise. - */ - public boolean addAll(Collection<? extends TimeSlotEntry> collection) { - boolean result = true; - - // adds the collection to the list and sets the start - // and finish time again - if(collection != null && !collection.isEmpty()) { - list_.addAll(collection); - Collections.sort(list_); - } - return result; - } - - /** - * Removes all elements from the list. - */ - public void clear() { - list_.clear(); - } - - /** - * Returns a shallow copy of this list. - * (The elements themselves are not copied.) - */ - public Object clone() { - return list_.clone(); - } - - /** - * Returns <tt>true</tt> if this list contains the specified element. - * @param entry the entry whose presence in this List is to be tested. - * @return <tt>true</tt> if the specified element is present; - * <tt>false</tt> otherwise. - */ - public boolean contains(Object entry) { - return list_.contains(entry); - } - - /** - * Returns the element at the specified position in this list. - * @param index the index of the element to return - * @return the element at the specified position in this list. - */ - public TimeSlotEntry get(int index) { - return list_.get(index); - } - - /** - * Searches for the first occurence of the given argument, - * testing for equality using the equals method. - * @param entry the entry whose index is to be returned - * @return the index of the first occurrence of the argument - * in this list; returns <tt>-1</tt> if the object is not found. - */ - public int indexOf(Object entry) { - return list_.indexOf(entry); - } - - /** - * Tests if this list has no elements. - * @return <tt>true</tt> if the list has no elements. - */ - public boolean isEmpty() { - return list_.isEmpty(); - } - - /** - * Returns an iterator over the elements in this list in proper sequence. - * @return the iterator. - */ - public Iterator<TimeSlotEntry> iterator() { - return list_.iterator(); - } - - /** - * Removes the element at a given index - * @param index the index of the element to be removed - * @return the removed element. - */ - public TimeSlotEntry remove(int index) { - return list_.remove(index); - } - - /** - * Removes a given element from the list. - * @param entry the entry to be removed - * @return <tt>true</tt> if the collection contained the - * specified entry. - */ - public boolean remove(Object entry) { - return list_.remove(entry); - } - - /** - * Returns the size of this list. - * @return the size of this list - */ - public int size() { - return list_.size(); - } - - /** - * Scans the entries in a list and returns the first time frame over - * which a request with the characteristics provided can be scheduled - * @param duration the duration of the request - * @param reqPE the number of PEs required - * @return the start time or <tt>-1</tt> if not found - */ - public double getPotentialStartTime(int duration, int reqPE) { - - // the anchor index, the entry in the profile where - // the request would be placed OR the closest entry to the - // point where the anchor of the request would be placed - int anchorIndex = -1; - - // a pointer to the anchor entry (described above) - TimeSlotEntry anchorEntry = null; - - // the list of selected ranges - PERangeList intersectList = null; - - double potStartTime = -1; // keep the potential start time of the request - double potFinishTime = -1; // store the gridlet's expected finish time - - intersectList = null; - int length = list_.size(); - - Iterator<TimeSlotEntry> iterProfile = list_.iterator(); - while(iterProfile.hasNext()) { - - TimeSlotEntry entry = iterProfile.next(); - anchorEntry = entry; - anchorIndex = list_.indexOf(anchorEntry); - - // sets the start time as the time of the entry - potStartTime = entry.getTime(); - // calculates when the finish time will be if - // the gridlet is put at this position - potFinishTime = potStartTime + duration; - - // scan the profile until an entry with enough PEs is found - if(entry.getNumPE() < reqPE) { - continue; - } - else { - // if an entry with enough PEs is found, then scan the list - // from that point onwards analysing the intersection of - // the ranges available in the entries until the - // request expected completion time - intersectList = entry.getAvailRanges().clone(); - - // Look for the intersection of available ranges from - // the anchor until the end of the profile or until - // the entries are further than the expected completion time - for(int i=anchorIndex+1; i<length; i++){ - TimeSlotEntry nextEntry = list_.get(i); - if(nextEntry.getTime() > potFinishTime){ - break; - } - else{ - // if the finish time is equals to the entry time, so there - // is no need to check the intersection - if(nextEntry.getTime() < potFinishTime) { - intersectList = PERangeList.intersection(intersectList, - nextEntry.getAvailRanges()); - if(intersectList == null || intersectList.getNumPE() < reqPE) { - break; - } - } - } - } - // If a time slot with enough PEs has been found, then stop the search - if(intersectList != null && intersectList.getNumPE() >= reqPE) { - break; - } - } - } - - // if the potential finish time is larger than the end time of - // this list, then the request cannot be scheduled - if(potFinishTime > finishTime_) { - potStartTime = UNKNOWN; - } - - return potStartTime; - } - - /** - * Creates a string representation of the list - * @return a string representation - */ - public String toString() { - String result = "Availability={\n"; - for(TimeSlotEntry entry : list_){ - result += entry + "\n"; - } - result += "}"; - return result; - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-31 03:45:27
|
Revision: 76 http://gridsim.svn.sourceforge.net/gridsim/?rev=76&view=rev Author: marcos_dias Date: 2007-10-30 20:45:23 -0700 (Tue, 30 Oct 2007) Log Message: ----------- Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java Added Paths: ----------- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java Removed Paths: ------------- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java Modified: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java 2007-10-31 03:45:23 UTC (rev 76) @@ -7,6 +7,8 @@ package gridsim.gui; +import gridsim.Gridlet; + /** * {@link AllocationListener} interface has to be implemented by * classes that register with the allocation policy to receive @@ -23,7 +25,7 @@ /** * This method has to be implemented by the listener * to handle the action - * @param action the action taken by the {@link AllocationSubject} object + * @param action the action taken by an entity * @return <tt>true</tt> if the action has been handled successfully * or <tt>false</tt> otherwise. */ Modified: branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-10-31 03:45:23 UTC (rev 76) @@ -51,8 +51,8 @@ import javax.swing.event.ListSelectionListener; /** - * {@link GridSimVisualiser} is the class that represents the main window. - * used by the visualisation tool. From this window it is possible to + * {@link DefaultGridSimVisualizer} is the class that represents the + * main window used by the visualisation tool. From this window it is possible to * start the simulation, run step by step or run it in slow motion. <br> * <b>NOTE:</b> This visualisation tool should be used for debugging * purposes only. It is useful if you want to evaluate a new allocation @@ -68,10 +68,11 @@ * @see gridsim.GridSim#startGridSimulation(boolean) * @see gridsim.GridSim#startGridSimulation() * @see gridsim.turbo.ParallelSpaceShared - * @see gridsim.turbo.ARTParallelSpaceShared + * @see gridsim.turbo.ARParallelSpaceShared */ public class DefaultGridSimVisualizer extends JFrame - implements ActionListener, ListSelectionListener, GridSimVisualizer { + implements ActionListener, ListSelectionListener, + GridSimVisualizer { private static final long serialVersionUID = 2059324063853260682L; public static final int WINDOW_WIDTH = 400; @@ -100,17 +101,11 @@ // a list of all the allocation listeners in the system private static LinkedHashMap<Integer, AllocationListener> listeners_; - - // constants to indicate the time unit to be used for displaying - // information - public static final int TIME_UNIT_SECOND = 0; - public static final int TIME_UNIT_MINUTE = 1; - public static final int TIME_UNIT_HOUR = 2; - + static { listeners_ = new LinkedHashMap<Integer, AllocationListener>(); } - + /** * Creates the main window of the visualiser. */ Modified: branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-31 03:45:23 UTC (rev 76) @@ -9,6 +9,12 @@ public interface GridSimVisualizer { + // constants to indicate the time unit to be used for displaying + // information + public static final int TIME_UNIT_SECOND = 1; + public static final int TIME_UNIT_MINUTE = 60; + public static final int TIME_UNIT_HOUR = 60 * 60; + /** * Notifies a listener about the action performed * @param action the action performed Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-31 03:45:23 UTC (rev 76) @@ -28,6 +28,7 @@ import gridsim.turbo.ScheduleItem; import java.awt.AlphaComposite; +import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Composite; @@ -114,7 +115,7 @@ private JRadioButton secondButton_; private JRadioButton minuteButton_; private JRadioButton hourButton_; - private boolean drawID_; + private boolean drawID_ = true; // the left panel itself, the scroller for the scheduling queue panel // and the panel where the jobs are drawn @@ -122,7 +123,7 @@ private JScrollPane scroller_; private DrawingPanel drawingPanel_; private long currentTime_; - private double timeSpan_; + private double timeSpan_ = 200; // the panel that shows the list of gridlets or advance reservations private ItemPanel itemPanel_; @@ -131,12 +132,12 @@ private ArrayList<ScheduleItem> scheduledItems_; // time unit used to display information on the screen - private int timeUnit_; + private int timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND; private static final int WINDOW_WIDTH = 1100; private static final int WINDOW_HEIGHT = 300; - private static final int SHIFT_X = 20; - private static final int SHIFT_Y = 30; + private static final int SHIFT_X = 30; + private static final int SHIFT_Y = 25; private static final int SHIFT_BOTTOM = 15; /** @@ -146,23 +147,21 @@ */ public ResourceWindow(GridResource resource, int windowId) { resource_ = resource; - numPE_ = resource_.getResourceCharacteristics().getNumPE(); - timeSpan_ = 200; // default time span of 200 seconds + numPE_ = resource_.getResourceCharacteristics().getNumPE(); // sets layout to null as the components are resized // by a component adaptor triggered by resizing the window super.getContentPane().setLayout(null); super.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); - drawID_ = true; - timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_SECOND; - // initialises the list of Gridlets scheduledItems_ = new ArrayList<ScheduleItem>(); // initialise the left and right panels initPanels(); - super.addComponentListener(new ResizeFrame(this)); + ResizeFrame adapter = new ResizeFrame(); + adapter.frame_ = this; + super.addComponentListener(adapter); super.setLocation(DefaultGridSimVisualizer.WINDOW_WIDTH, windowId * 200); super.setTitle("Resource Information Window - " + @@ -175,13 +174,13 @@ * Returns the name of the resource associated with this window * @return the resource name */ - public String getResourceName(){ + public String getResourceName() { return resource_.get_name(); } /** * Handles allocation actions - * @param an allocation action performed by the @link{AllocationSubject} + * @param action an allocation action performed */ public boolean allocationActionPerformed(AllocationAction action) { int type = action.getActionType(); @@ -233,24 +232,19 @@ * @param e the event received */ public void actionPerformed(ActionEvent e) { - if (e.getSource() == secondButton_) { - if(secondButton_.isSelected()) { - timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_SECOND; - itemPanel_.updatePanel(); - } + if (e.getSource() == secondButton_ && secondButton_.isSelected()) { + timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND; } - else if (e.getSource() == minuteButton_) { - if(minuteButton_.isSelected()) { - timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_MINUTE; - itemPanel_.updatePanel(); - } + else if (e.getSource() == minuteButton_ && minuteButton_.isSelected()) { + timeUnit_ = GridSimVisualizer.TIME_UNIT_MINUTE; } - else if (e.getSource() == hourButton_) { - if(hourButton_.isSelected()) { - timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_HOUR; - itemPanel_.updatePanel(); - } + else if (e.getSource() == hourButton_ && hourButton_.isSelected()) { + timeUnit_ = GridSimVisualizer.TIME_UNIT_HOUR; } + + if(scheduledItems_.size() > 0) + itemPanel_.updatePanel(); + updateResourceWindow(); } @@ -265,12 +259,9 @@ // calculates the size of the two panels // to be added to the window - int windowWidth = super.getWidth(); - int windowHeight = super.getHeight(); - - int leftPanelWidth = (int)((windowWidth/3.5) * 2.3); - int leftPanelHeight = (int)((windowHeight) - 20); - int gridletPanelWidth = (int)((windowWidth/3.5) * 1.2); + int leftPanelWidth = (int)((super.getWidth()/3.5) * 2.3); + int leftPanelHeight = (int)((super.getHeight()) - 20); + int gridletPanelWidth = (int)((super.getWidth()/3.5) * 1.2); int gridletPanelHeight = leftPanelHeight; int leftPanelXPos = 0; int gridletPanelXPos = leftPanelXPos + leftPanelWidth; @@ -353,7 +344,6 @@ //Set up the drawing area. drawingPanel_ = new DrawingPanel(); - drawingPanel_.setBackground(new Color(20, 15, 60)); //Put the drawing area in a scroll pane. scroller_ = new JScrollPane(drawingPanel_); @@ -384,14 +374,10 @@ timeSpan_ = time; return true; } - else { + else return false; - } } - /** - * Updates the interface of the resource window - */ private void updateResourceWindow(){ drawingPanel_.repaint(); } @@ -401,30 +387,21 @@ * @param the time in seconds * @return the time in the unit in use */ - private double convertToUnitInUse(double time) { - if(timeUnit_ == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { - return time; - } - else if(timeUnit_ == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { - return time/60; - } - else { - return time/60/60; - } + private double convertTime(double time) { + return time / timeUnit_; } // -------------------------- PRIVATE CLASSES ----------------------- /** - * Private class responsible for resizing the two main panels + * Class responsible for resizing the two main panels * that compose the resource window interface */ class ResizeFrame extends ComponentAdapter { JFrame frame_ = null; - public ResizeFrame(JFrame frame) { + public ResizeFrame() { super(); - frame_ = frame; } public void componentResized(ComponentEvent evt) { @@ -449,10 +426,9 @@ } /** - * The panel inside the scroll pane where the - * gridlets are shown. + * The panel inside the scroll pane where the jobs are shown. */ - private class DrawingPanel extends JPanel { + class DrawingPanel extends JPanel { private static final long serialVersionUID = -636030997043222745L; @@ -460,6 +436,20 @@ private int panelWidth_; private float scaleY_; private float scaleX_; + + private BasicStroke dashedStroke_ = new BasicStroke(1, BasicStroke.CAP_ROUND, + BasicStroke.JOIN_ROUND, 4, new float[]{2.0f}, 0); + private BasicStroke normalStroke_ = new BasicStroke(1); + + private Color backgroundColor_ = new Color(20, 15, 60); + private Color timeGridColor_ = Color.LIGHT_GRAY; + private Color topTextColor_ = Color.WHITE; + private Color bottomTextColor_ = Color.RED; + private Color graphBorderColor_ = Color.WHITE; + private Color currentTimeLineColor_ = Color.GREEN; + private Font graphFont_ = new Font("Dialog", Font.BOLD, 10); + + private Composite transpComp_ = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f); // some colors to draw the jobs private final Color colorsQueued[] = @@ -477,35 +467,17 @@ // a job to be highlited. That is, if the user selects a gridlet or advance // reservation in the list, then it can see in the panel what gridlet has // been selected - private ScheduleItem highlightedItem_; + ScheduleItem highlightedItem_ = null; - /** - * Default constructor - */ public DrawingPanel(){ super(); - - // starts the highlighted item as none - highlightedItem_ = null; + super.setBackground(backgroundColor_); } - - /** - * Sets the item to be highlighted - * @param item the item to be highlighted - */ - protected synchronized void setHighlightedItem(ScheduleItem item) { - highlightedItem_ = item; - } - /* - * (non-Javadoc) - * @see javax.swing.JComponent#paintComponent(java.awt.Graphics) - */ - protected synchronized void paintComponent(Graphics g2D) { - super.paintComponent(g2D); - - Font font = new Font("Dialog", Font.BOLD, 10); - g2D.setFont(font); + protected synchronized void paintComponent(Graphics g2) { + super.paintComponent(g2); + Graphics2D g2D = (Graphics2D)g2; + g2D.setFont(graphFont_); panelHeight_ = leftPanel_.getHeight() - 100 - SHIFT_Y - SHIFT_BOTTOM; panelWidth_ = leftPanel_.getWidth() - 50 - 2 * SHIFT_X; @@ -519,63 +491,90 @@ super.setPreferredSize(new Dimension((int) (timeSpan_ * scaleX_) + 2 * SHIFT_X, (int) ((numPE_) * scaleY_) + SHIFT_Y + SHIFT_BOTTOM)); - super.setForeground(Color.GREEN); - - g2D.drawRect(SHIFT_X, SHIFT_Y, (int) (timeSpan_ * scaleX_), - (int) (numPE_ * scaleY_)); - - drawSchedulingQueue(scheduledItems_, scaleY_, scaleX_, g2D); - drawTimeGrid(scaleX_, scaleY_, timeSpan_, g2D); + drawSchedulingQueue(g2D); + drawGridsAndAxes(g2D); super.revalidate(); } /** * Draws the lines and time scale on the scheduling window - * @param scaleX the current zoom scale of the X axis - * @param scaleY the current zoom scale of the Y axis * @param timeSpan the time span of the simulation * @param g2D the graphics 2D context */ - private void drawTimeGrid(float scaleX, float scaleY, double timeSpan, Graphics g2D) { - for(int i = 0 ; i <= (int)(timeSpan * scaleX) ; i += 50) { - g2D.setColor(Color.GREEN); - g2D.drawLine(SHIFT_X + (int)(i), SHIFT_Y + 0, SHIFT_X + - (int)( i ), SHIFT_Y + (int)(numPE_ * scaleY)); - - g2D.setColor(Color.RED); - g2D.drawString(new Integer((int)convertToUnitInUse((i/scaleX))).toString(), - SHIFT_X + i, SHIFT_Y + (int)(numPE_ * scaleY) + 20); + private void drawGridsAndAxes(Graphics2D g2D) { + + String text = null; + g2D.setColor(timeGridColor_); + g2D.setStroke(dashedStroke_); + + Composite previousComposite = g2D.getComposite(); + g2D.setComposite(transpComp_); + + int heightGph = (int)(numPE_ * scaleY_); + int widthGph = (int) (timeSpan_ * scaleX_); + int x, y; + + for(int i=0; i<=widthGph; i+=50) { + x = SHIFT_X + i; + g2D.drawLine(x, SHIFT_Y, x, SHIFT_Y + heightGph); } - - g2D.setColor(Color.WHITE); - - g2D.drawLine(SHIFT_X + (int)(currentTime_ * scaleX), SHIFT_Y - 10, - SHIFT_X + (int)(currentTime_ * scaleX), SHIFT_Y + (int)(numPE_ * scaleY) + 10); - - g2D.drawString("CT: "+ (new Integer((int)(convertToUnitInUse(currentTime_)) ).toString()), - SHIFT_X + (int)(currentTime_ * scaleX), SHIFT_Y - 20); - - g2D.drawLine(SHIFT_X + (int)(timeSpan * scaleX), SHIFT_Y - 10, - SHIFT_X + (int)(timeSpan * scaleX), SHIFT_Y + (int)(numPE_ * scaleY) + 10); - - g2D.drawString("Time Span: "+ (new Integer((int)(convertToUnitInUse(timeSpan)) ).toString()), - (int)(timeSpan * scaleX) - 40, SHIFT_Y - 20); + + g2D.setComposite(previousComposite); + g2D.setStroke(normalStroke_); + + g2D.setColor(graphBorderColor_); + g2D.drawRect(SHIFT_X, SHIFT_Y, widthGph, heightGph); + + for(int i=0; i <= widthGph; i+=50) { + x = SHIFT_X + i; + g2D.drawLine(x, SHIFT_Y + heightGph - 5, x, SHIFT_Y + heightGph + 3); + } + + g2D.setColor(bottomTextColor_); + y = SHIFT_Y + heightGph + 20; + for(int i=0; i<=widthGph; i+=50) { + text = "" + (int)convertTime((i/scaleX_)); + g2D.drawString(text, SHIFT_X + i - ((text.length() * 6)/2), y); + } + + g2D.setColor(topTextColor_); + text = "CT: "+ (int)(convertTime(currentTime_)); + g2D.drawString(text, SHIFT_X + (int)(currentTime_ * scaleX_) - (text.length() * 5), + SHIFT_Y - 10); + + text = "Time Span: " + (int)(convertTime(timeSpan_)); + y = SHIFT_Y + (text.length() * 6); + x = widthGph + SHIFT_X + 15; + g2D.rotate(-1.571, x, y); + g2D.drawString(text, x, y); + g2D.rotate(1.571, x, y); + + x = SHIFT_X - 5; + y = heightGph + SHIFT_Y - 10; + g2D.rotate(-1.571, x, y); + g2D.drawString("Processing Elements", x, y); + g2D.rotate(1.571, x, y); + + g2D.setColor(currentTimeLineColor_); + x = SHIFT_X + (int)(currentTime_ * scaleX_); + g2D.drawLine(x, SHIFT_Y - 7, x, SHIFT_Y + heightGph + 10); } /* * Draws the boxes representing the gridlets or advance reservations */ - private void drawSchedulingQueue(ArrayList<ScheduleItem> queue, - float scaleY, float scaleX, Graphics g2D) { + private void drawSchedulingQueue(Graphics2D g2D) { Color boxColor = null; Color fontColor = null; - int size = queue.size(); + int size = scheduledItems_.size(); for(int i=0; i<size; i++) { - ScheduleItem item = (ScheduleItem)queue.get(i); + ScheduleItem item = (ScheduleItem)scheduledItems_.get(i); + if(item == null) + continue; + int itemId = item.getID(); - if (item.getPERangeList() != null){ // the color of the font for normal gridlets is black fontColor = Color.BLACK; @@ -613,13 +612,13 @@ boxColor = colorsDone[(itemId % colorsDone.length)]; } } - drawItem((Graphics2D) g2D, item, boxColor, fontColor, scaleY, scaleX); + drawItem((Graphics2D) g2D, item, boxColor, fontColor); } } // if there is an item to be highlighted, then do it if(highlightedItem_ != null) { - highlightItem((Graphics2D) g2D, highlightedItem_, scaleY, scaleX); + highlightItem((Graphics2D) g2D, highlightedItem_); } } @@ -628,7 +627,7 @@ * This method assumes that the gridlet has a range of PEs */ private void drawItem(Graphics2D g2D, ScheduleItem item, Color boxColor, - Color fontColor, float scaleY, float scaleX) { + Color fontColor) { int y; int h = 0; //controls the height to draw the gridlet PERangeList gridletPERanges = item.getPERangeList(); @@ -642,8 +641,8 @@ // gets the time duration of the gridlet double duration = item.getFinishTime() - item.getStartTime(); - width = (int) (duration * scaleX); - firstX = SHIFT_X + (int) (item.getStartTime() * scaleX); + width = (int) (duration * scaleX_); + firstX = SHIFT_X + (int) (item.getStartTime() * scaleX_); String boxText; LineMetrics lineMetrics; @@ -658,8 +657,8 @@ y = range.getEnd(); h = range.getNumPE(); - firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY); - height = (int) ((h) * scaleY); + firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY_); + height = (int) ((h) * scaleY_); // if it is a gridlet that reserved resources, then make it // transparent to show the advance reservation as well @@ -667,9 +666,7 @@ Composite previousComposite = null; if(reservedGridlet) { previousComposite = g2D.getComposite(); - AlphaComposite ac = - AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f); - g2D.setComposite(ac); + g2D.setComposite(transpComp_); } g2D.setColor(boxColor); @@ -702,8 +699,7 @@ * Highlights a schedule item. This method basically draws the item * in the resource window with red lines. */ - private void highlightItem(Graphics2D g2D, ScheduleItem item, - float scaleY, float scaleX) { + private void highlightItem(Graphics2D g2D, ScheduleItem item) { int y; int h = 0; //controls the height to draw the gridlet @@ -720,8 +716,8 @@ // gets the time duration of the gridlet double duration = item.getFinishTime() - item.getStartTime(); - width = (int) (duration * scaleX); - firstX = SHIFT_X + (int) (item.getStartTime() * scaleX); + width = (int) (duration * scaleX_); + firstX = SHIFT_X + (int) (item.getStartTime() * scaleX_); // A gridlet can have the nodes 0-2, 5-7, etc. // So it must be painted in parts @@ -729,8 +725,8 @@ y = range.getEnd(); h = range.getNumPE(); - firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY); - height = (int) ((h) * scaleY); + firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY_); + height = (int) ((h) * scaleY_); g2D.setColor(Color.RED); g2D.drawRect(firstX, firstY, width, height); @@ -763,16 +759,11 @@ private JTextArea itemInfoArea_; private Vector<ScheduleItem> items_; - /** - * Creates a new {@link ItemPanel} object. - * @param frame the frame in which the panel will be inserted - */ - public ItemPanel() { + + protected ItemPanel() { init("Information About Gridlets and Reservations"); } - // ---------------------- PUBLIC METHODS ---------------------- - /** * Handles events triggered by the change of the list of Gridlets * @see ListSelectionListener#valueChanged(ListSelectionEvent) @@ -783,7 +774,7 @@ if (item != null) { updateItemDetails(item); - drawingPanel_.setHighlightedItem(item); + drawingPanel_.highlightedItem_ = item; drawingPanel_.repaint(); } } @@ -795,7 +786,7 @@ * the list and updates the details. * @param item the item whose information has to be updated */ - public void updateItem(ScheduleItem item) { + protected void updateItem(ScheduleItem item) { int position = getPosition(item.getID(), item.getUserID(), item.isAdvanceReservation()); @@ -811,7 +802,7 @@ /** * Called when an update of the whole panel is needed */ - public void updatePanel() { + protected void updatePanel() { int selectedIndex = (int) itemQueueJList_.getSelectedIndex(); ScheduleItem item = items_.get(selectedIndex); @@ -840,11 +831,13 @@ scrollPaneJobs.setBorder(new TitledBorder("List")); super.setLayout(new GridLayout(1, 2)); + itemQueueJList_.setFont(itemQueueJList_.getFont().deriveFont(9.5f)); itemQueueJList_.setBackground(super.getBackground()); scrollPaneJobs.setBackground(super.getBackground()); // the list that contains the details of an item itemInfoArea_ = new JTextArea(); + itemInfoArea_.setFont(itemInfoArea_.getFont().deriveFont(9.5f)); Border panelBorder = new CompoundBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0), Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-31 03:45:23 UTC (rev 76) @@ -120,7 +120,8 @@ * Instantiates a new {@link ARMessage} object. * @param sourceId the id of entity that is the source of this message * @param reservation the reservation to which this message refers - * @throws ParameterException is thrown if the ID is < 0 + * @throws ParameterException is thrown if the IDs are < 0 or + * the reservation object is <tt>null</tt> */ public ARMessage(int sourceId, Reservation reservation) throws ParameterException { @@ -140,7 +141,7 @@ * @param destId the id of the entity that is the recipient of this message * @param reservation the reservation to which this message refers * @throws ParameterException is thrown if the IDs are < 0 or - * the negotiation object is <tt>null</tt> + * the reservation object is <tt>null</tt> */ public ARMessage(int sourceId, int destId, Reservation reservation) throws ParameterException { @@ -431,7 +432,7 @@ * @return a String representing the negotiation message */ public String toString() { - String result = "{AR Message: " + + return "{AR Message: " + "[Type = " + getMessageTypeString(msgType_) + "]," + "[Source ID = " + srcId_ + "],"+ "[Destination ID = " + dstId_ + "],"+ @@ -439,7 +440,5 @@ "[Reservation ID = " + ((reservation_ == null) ? -1 : reservation_.getID()) + "],"+ "[Error Code = " + getErrorCodeString(errorCode_) + "],"+ "[Price = " + price_ + "]}"; - - return result; } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-31 03:45:23 UTC (rev 76) @@ -2293,7 +2293,7 @@ * in the scheduling queue managed by this scheduler or * resource allocation policy. * @param startTime the start time in which the requester is interested. - * @param finishTime the finish time in which the requester is interested. + * @param duration the duration in which the requester is interested. * @return the list of free time slots. The list is actually a list of * entries that correspond to the availability profile between the times * specified by the requester. Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2007-10-31 03:45:23 UTC (rev 76) @@ -59,7 +59,7 @@ * @pre entityName != null * @post $none */ - protected ARTPolicy(String resourceName, String entityName) + public ARTPolicy(String resourceName, String entityName) throws Exception { super(resourceName, entityName); } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2007-10-31 03:45:23 UTC (rev 76) @@ -100,6 +100,7 @@ /** * Returns the number of Gridlets that rely on this entry to mark * their expected completion time or their anchor point + * @return the number of Gridlets that use this entry */ public int getNumGridlets(){ return numGridlets_; Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java 2007-10-31 03:45:23 UTC (rev 76) @@ -8,7 +8,6 @@ package gridsim.turbo; -import gridsim.GridSimTags; import eduni.simjava.Sim_predicate; import eduni.simjava.Sim_event; Added: branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java 2007-10-31 03:45:23 UTC (rev 76) @@ -0,0 +1,51 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + */ + +package gridsim.turbo; + +import java.util.Comparator; + +/** + * Class used to order the gridlets according to their + * potential start times + * @author Marcos Dias de Assuncao + * + */ +public class OrderGridletByStartTime implements Comparator<SSGridlet> { + + /** + * Default constructor. + */ + public OrderGridletByStartTime() { + super(); + } + + /** + * Compares two SSGridlets objects. It uses the potential start time + * for comparison. If the two gridlets have the same start time, then + * the serial number of the gridlets is used. That is, the order in + * which the gridlets have been created + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ + public int compare(SSGridlet gridletA, SSGridlet gridletB) { + if(gridletA == gridletB) + return 0; + + int result = 0; + Double timeA = gridletA.getStartTime(); + Double timeB = gridletB.getStartTime(); + result = timeA.compareTo(timeB); + + if(result == 0){ + Long serialA = gridletA.getSerial(); + Long serialB = gridletB.getSerial(); + result = serialA.compareTo(serialB); + } + return result; + } +} \ No newline at end of file Deleted: branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java 2007-10-31 03:45:23 UTC (rev 76) @@ -1,58 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - */ - -package gridsim.turbo; - -import java.util.Comparator; - -/** - * Class used to order the gridlets according to their - * potential start times - * @author Marcos Dias de Assuncao - * - */ -class OrderGridletByStartTime implements Comparator<SSGridlet> { - - /** - * Default constructor. - */ - public OrderGridletByStartTime() { - super(); - } - - /** - * Default constructor. - */ - public OrderGridletByStartTime(int order) { - super(); - } - - /** - * Compares two SSGridlets objects. It uses the potential start time - * for comparison. If the two gridlets have the same start time, then - * the serial number of the gridlets is used. That is, the order in - * which the gridlets have been created - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(SSGridlet gridletA, SSGridlet gridletB) { - if(gridletA == gridletB) - return 0; - - int result = 0; - Double timeA = gridletA.getStartTime(); - Double timeB = gridletB.getStartTime(); - result = timeA.compareTo(timeB); - - if(result == 0){ - Long serialA = gridletA.getSerial(); - Long serialB = gridletB.getSerial(); - result = serialA.compareTo(serialB); - } - return result; - } -} \ No newline at end of file Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java 2007-10-31 03:45:23 UTC (rev 76) @@ -89,7 +89,7 @@ /** * Compares this range against another range of PEs. - * @param the range to compare this range with + * @param range the range to compare this range with * @return <tt>-1</tt> if the beginning of this range is * smaller than the other range, <tt>0</tt> if they are * the same and <tt>1<tt> the beginning of this range is bigger @@ -115,7 +115,7 @@ } /** - * Creates a string represenation of this class + * Creates a string representation of this class * @return the string representation */ public String toString(){ Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-31 03:45:23 UTC (rev 76) @@ -10,6 +10,7 @@ import eduni.simjava.Sim_event; import eduni.simjava.Sim_system; +import gridsim.GridResource; import gridsim.GridSim; import gridsim.GridSimTags; import gridsim.Gridlet; Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2007-10-31 03:45:23 UTC (rev 76) @@ -109,6 +109,8 @@ /** * This method is implemented as ScheduleItem requires + * @return <tt>true</tt> if the gridlet has made a reservation or + * <tt>false</tt> otherwise. */ public boolean hasReserved() { return true; @@ -140,13 +142,8 @@ /** * Sets the start time (in seconds) for this reservation. - * The start time should be greater than simulation init time defined - * in {@link gridsim.GridSim#init(int, Calendar, boolean)} - * @param startTime the reservation start time in milliseconds + * @param startTime the reservation start time in seconds * @return <tt>true</tt> if successful, <tt>false</tt> otherwise - * @see gridsim.GridSim#init(int, Calendar, boolean) - * @pre startTime > 0 - * @post $none */ public boolean setStartTime(double startTime) { if (startTime < 0) { @@ -159,10 +156,9 @@ /** * Sets the duration time (unit in seconds) for this reservation. - * @param duration the reservation duration time. Time unit is in milliseconds. + * @param duration the reservation duration time. Time unit is in seconds. * @return <tt>true</tt> if successful, <tt>false</tt> otherwise * @pre duration > 0 - * @post $none */ public boolean setDurationTime(int duration) { if (duration <= 0) { @@ -221,8 +217,8 @@ } /** - * Gets this object's start time in seconds - * @return the reservation start time in seconds + * Gets this object's finish time in seconds + * @return the reservation finish time in seconds * @pre $none * @post $none */ @@ -309,7 +305,7 @@ /** * Returns a clone of this object - * @see java.lang.Object#clone() + * @return a cloned reservation object */ public Reservation clone() { Reservation reservation = new Reservation(userID_); @@ -322,7 +318,8 @@ * Returns a negative integer, zero, or a positive integer as this * reservation is less than, equal to, or greater than the specified * reservation. - * @param the reservation against which this reservation has to be compared + * @param reservation the reservation against which this reservation + * has to be compared * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(Reservation reservation) { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-31 03:45:23 UTC (rev 76) @@ -169,7 +169,6 @@ * @param startTime reservation start time in seconds * @param duration reservation end time in seconds * @param numPE number of PEs required for this reservation - * @param resID a resource ID * @return a reservation object containing the new reservation or * <tt>null</tt> if an error happened during the request */ Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-31 03:45:23 UTC (rev 76) @@ -11,14 +11,14 @@ import gridsim.GridSim; import gridsim.Gridlet; -import gridsim.gui.DefaultGridSimVisualizer; +import gridsim.gui.GridSimVisualizer; /** * GridSim @link{SSGridlet} represents a Gridlet submitted to * @link{GridResource} for processing (Server Side). This class keeps track of the time * for all activities in the @link{GridResource} for a specific Gridlet. * Before a Gridlet exits the GridResource, it is RECOMMENDED to call this method - * {@link #finalizeGridlet()}. + * {@link SSGridlet#finalizeGridlet()}. * <p> * It contains a Gridlet object along with its arrival time and * the ranges of PEs (Processing Element) allocated to it. @@ -436,26 +436,25 @@ * Creates a String representation of this Gridlet * for displaying purposes * @param timeUnit the time unit to be used - * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND - * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE - * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR + * @see GridSimVisualizer#TIME_UNIT_SECOND + * @see GridSimVisualizer#TIME_UNIT_MINUTE + * @see GridSimVisualizer#TIME_UNIT_HOUR */ public String toString(int timeUnit){ - String unitDesc = getTimeUnitDescription(timeUnit); - String result = "Gridlet ID: " + gridlet_.getGridletID() + "\n" + + String timeDescr = getTimeDescr(timeUnit); + return "Gridlet ID: " + gridlet_.getGridletID() + "\n" + "User ID: " + gridlet_.getUserID() + "\n" + "Status: " + Gridlet.getStatusString(gridlet_.getGridletStatus()) + "\n" + - "Sub. Time: " + decFormater_.format(convertToUnitInUse(getSubmissionTime(), timeUnit)) + - " " + unitDesc + "\n" + - "Start Time: " + decFormater_.format(convertToUnitInUse(startTime_, timeUnit)) + - " " + unitDesc + "\n" + - "FinishTime: " + decFormater_.format(convertToUnitInUse(finishedTime_, timeUnit)) + - " " + unitDesc + "\n" + - "Duration: " + decFormater_.format(convertToUnitInUse(finishedTime_ - startTime_, timeUnit)) + - " " + unitDesc + "\n" + + "Sub. Time: " + decFormater_.format(convertTime(getSubmissionTime(), timeUnit)) + + " " + timeDescr + "\n" + + "Start Time: " + decFormater_.format(convertTime(startTime_, timeUnit)) + + " " + timeDescr + "\n" + + "FinishTime: " + decFormater_.format(convertTime(finishedTime_, timeUnit)) + + " " + timeDescr + "\n" + + "Duration: " + decFormater_.format(convertTime(finishedTime_ - startTime_, timeUnit)) + + " " + timeDescr + "\n" + "Length: " + decFormater_.format(gridlet_.getGridletLength()) + " MIs" + "\n" + "Num. PEs: " + numPE_; - return result; } // -------------------- PRIVATE METHODS --------------------- @@ -468,7 +467,6 @@ private void init() { // get number of PEs required to run this Gridlet this.numPE_ = gridlet_.getNumPE(); - peRangeList_ = new PERangeList(); this.arrivalTime_ = GridSim.clock(); this.gridlet_.setSubmissionTime(arrivalTime_); @@ -490,11 +488,11 @@ * @param timeUnit the time unit id * @return the string containing the description */ - private String getTimeUnitDescription(int timeUnit) { - if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { + private String getTimeDescr(int timeUnit) { + if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) { return "sec."; } - else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) { return "min."; } else { @@ -507,18 +505,9 @@ * @param the time in seconds * @return the time in the unit in use */ - private double convertToUnitInUse(double time, int timeUnit) { - if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { - return time; - } - else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { - return time/60; - } - else { - return time/60/60; - } + private double convertTime(double time, int timeUnit) { + return time / timeUnit; } - } // end class Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-31 03:45:23 UTC (rev 76) @@ -7,10 +7,8 @@ package gridsim.turbo; -import gridsim.gui.DefaultGridSimVisualizer; - +import gridsim.gui.GridSimVisualizer; import java.text.DecimalFormat; -import java.util.Calendar; /** * GridSim @link{SSReservation} represents a reservation on the resource @@ -114,9 +112,6 @@ return peRanges_; } - - - /** * Returns the number of PEs still available that have not been * allocated to gridlets @@ -184,13 +179,8 @@ /** * Sets the start time (in seconds) for this reservation. - * The start time should be greater than simulation init time defined - * in {@link gridsim.GridSim#init(int, Calendar, boolean)} - * @param startTime the reservation start time in milliseconds + * @param startTime the reservation start time in seconds * @return <tt>true</tt> if successful, <tt>false</tt> otherwise - * @see gridsim.GridSim#init(int, Calendar, boolean) - * @pre startTime > 0 - * @post $none */ public boolean setStartTime(double startTime) { if(reservation_==null) @@ -201,7 +191,7 @@ /** * Sets the duration time (unit in seconds) for this reservation. - * @param duration the reservation duration time. Time unit is in milliseconds. + * @param duration the reservation duration time. Time unit is in seconds. * @return <tt>true</tt> if successful, <tt>false</tt> otherwise * @pre duration > 0 * @post $none @@ -266,8 +256,8 @@ } /** - * Gets this object's start time in seconds - * @return the reservation start time in seconds + * Gets this object's finish time in seconds + * @return the reservation finish time in seconds * @pre $none * @post $none */ @@ -345,22 +335,22 @@ * for displaying purposes * @param timeUnit the time unit to be used * @return the string representation - * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND - * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE - * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR + * @see GridSimVisualizer#TIME_UNIT_SECOND + * @see GridSimVisualizer#TIME_UNIT_MINUTE + * @see GridSimVisualizer#TIME_UNIT_HOUR */ public String toString(int timeUnit) { - String unitDesc = getTimeUnitDescription(timeUnit); + String unitDesc = getTimeDescr(timeUnit); String result = "Reservation ID: " + reservation_.getID() + "\n" + "User ID: " + getUserID() + "\n" + "Status: " + Reservation.getStatusString(reservation_.getStatus()) + "\n" + - "Sub. Time: " + decFormater_.format(convertToUnitInUse(getSubmissionTime(), timeUnit)) + + "Sub. Time: " + decFormater_.format(convertTime(getSubmissionTime(), timeUnit)) + " " + unitDesc + "\n" + - "Start Time: " + decFormater_.format(convertToUnitInUse(reservation_.getStartTime(), timeUnit)) + + "Start Time: " + decFormater_.format(convertTime(reservation_.getStartTime(), timeUnit)) + " " + unitDesc + "\n" + - "FinishTime: " + decFormater_.format(convertToUnitInUse(getFinishTime(), timeUnit)) + + "FinishTime: " + decFormater_.format(convertTime(getFinishTime(), timeUnit)) + " " + unitDesc + "\n" + - "Duration: " + decFormater_.format(convertToUnitInUse(reservation_.getDurationTime(), timeUnit)) + + "Duration: " + decFormater_.format(convertTime(reservation_.getDurationTime(), timeUnit)) + " " + unitDesc + "\n" + "Num. PEs: " + reservation_.getNumPE(); return result; @@ -372,7 +362,7 @@ * @return the string representation */ public String toString() { - return toString(DefaultGridSimVisualizer.TIME_UNIT_SECOND); + return toString(GridSimVisualizer.TIME_UNIT_SECOND); } /** @@ -381,11 +371,11 @@ * @param timeUnit the time unit id * @return the string containing the description */ - private static String getTimeUnitDescription(int timeUnit) { - if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { + private static String getTimeDescr(int timeUnit) { + if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) { return "sec."; } - else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) { return "min."; } else { @@ -398,16 +388,8 @@ * @param the time in seconds * @return the time in the unit in use */ - private static double convertToUnitInUse(double time, int timeUnit) { - if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { - return time; - } - else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { - return time/60; - } - else { - return time/60/60; - } + private static double convertTime(double time, int timeUnit) { + return time / timeUnit; } /** Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-31 03:45:23 UTC (rev 76) @@ -7,7 +7,7 @@ package gridsim.turbo; -import gridsim.gui.DefaultGridSimVisualizer; +import gridsim.gui.GridSimVisualizer; import gridsim.gui.ResourceWindow; /** @@ -98,9 +98,11 @@ * Creates a String representation of this item * for displaying purposes * @param timeUnit the time unit to be used - * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND - * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE - * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR + * @see GridSimVisualizer#TIME_UNIT_SECOND + * @see GridSimVisualizer#TIME_UNIT_MINUTE + * @see GridSimVisualizer#TIME_UNIT_HOUR + * @return a String representation of this item + * for displaying purposes */ public String toString(int timeUnit); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-31 03:45:23 UTC (rev 76) @@ -8,6 +8,7 @@ package gridsim.turbo; import gridsim.AllocPolicy; +import gridsim.GridResource; import java.util.Calendar; import java.util.Collection; @@ -15,8 +16,8 @@ /** * {@link TAllocPolicy} is an abstract class that handles the internal - * {@link TGridResource} allocation policy. New scheduling algorithms - * can be added into a {@link TGridResource} entity by extending this + * {@link GridResource} allocation policy. New scheduling algorithms + * can be added into a {@link GridResource} entity by extending this * class and implement the required abstract methods. * <p> * All the implementation details and the data structures chosen are up to @@ -31,10 +32,8 @@ * @since GridSim Turbo Alpha 0.1 * * @see gridsim.AllocPolicy - * @see gridsim.ARPolicy - * @see gridsim.ARTPolicy * @see gridsim.GridSim - * @see gridsim.TResourceCharacteristics + * @see TResourceCharacteristics */ public abstract class TAllocPolicy extends AllocPolicy { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2007-10-31 03:45:23 UTC (rev 76) @@ -34,7 +34,7 @@ // This variable stores the ranges of PEs available at the // present simulation time private PERangeList freePERanges_; - // the number of + // the number of PEs in this resource private int numPE_; /** Parallel spaced-shared system using First Come First Serve (FCFS) Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-10-31 03:45:23 UTC (rev 76) @@ -31,7 +31,7 @@ /** * Creates a new instance of {@link TimeSlotEntry} - * @time the time associated with this entry + * @param time the time associated with this entry */ public TimeSlotEntry(double time) { time_ = time; @@ -40,8 +40,8 @@ /** * Creates a new instance of {@link TimeSlotEntry} - * @time the time associated with this entry - * @ranges the list of ranges of PEs available + * @param time the time associated with this entry + * @param ranges the list of ranges of PEs available */ public TimeSlotEntry(double time, PERangeList ranges) { time_ = time; @@ -111,7 +111,7 @@ * Gets the number of PEs associated with this entry * @return the number of PEs */ - public int getNumPE(){ + public int getNumPE() { if(availRanges_ == null) return 0; else @@ -122,7 +122,7 @@ * Creates a string representation of this entry * @return a representation of this entry */ - public String toString(){ + public String toString() { return "{time="+ time_ + "; " + ( (availRanges_!=null) ? availRanges_ : "{[]}") + "}"; } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-10-19 00:52:11 UTC (rev 75) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-10-31 03:45:23 UTC (rev 76) @@ -217,7 +217,7 @@ * Scans the entries in a list and returns the first time frame over * which a request with the characteristics provided can be scheduled * @param duration the duration of the request - * @param numPE the number of PEs required + * @param reqPE the number of PEs required * @return the start time or <tt>-1</tt> if not found */ public double getPotentialStartTime(int duration, int reqPE) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-19 00:52:09
|
Revision: 75 http://gridsim.svn.sourceforge.net/gridsim/?rev=75&view=rev Author: marcos_dias Date: 2007-10-18 17:52:11 -0700 (Thu, 18 Oct 2007) Log Message: ----------- This update is to allow the user to change the default Graphical User Interface used by GridSim and provide his/her own. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/GridSim.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java Added Paths: ----------- branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java Modified: branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2007-10-19 00:52:11 UTC (rev 75) @@ -16,7 +16,7 @@ import eduni.simjava.Sim_event; import eduni.simjava.Sim_port; import gridsim.gui.AllocationAction; -import gridsim.gui.GridSimVisualizer; +import gridsim.gui.DefaultGridSimVisualizer; import gridsim.turbo.ScheduleItem; /** @@ -671,88 +671,5 @@ super.sim_schedule(myId_, time, tag, data); return true; } - - /** - * Notifies the listeners about the action performed - * @param allocationAction the action performed - * @param shouldPause indicates whether the simulation should be paused after - * notifying the listeners. <tt>true</tt> indicates that it should pause and - * <tt>false</tt> means that it should not. - * @param itemList the list of gridlets to provide to the listeners - * - * @see AllocationAction#ITEM_ARRIVED - * @see AllocationAction#ITEM_SCHEDULED - * @see AllocationAction#ITEM_CANCELLED - * @see AllocationAction#ITEM_COMPLETED - * @see AllocationAction#ITEM_STATUS_CHANGED - * @see AllocationAction#SCHEDULE_CHANGED - */ - protected void notifyListeners(int allocationAction, - boolean shouldPause, LinkedList itemList) { - - if(!GridSim.isDebugModeEnabled()) - return; - - AllocationAction action = new AllocationAction(allocationAction); - action.setSubject(this.get_id()); - action.setScheduleItems(itemList); - GridSimVisualizer.notifyListeners(action, shouldPause); - } - - /** - * Notifies the listeners about the action performed - * @param allocationAction the action performed - * @param shouldPause indicates whether the simulation should be paused after - * notifying the listeners. <tt>true</tt> indicates that it should pause and - * <tt>false</tt> means that it should not. - * @param item the gridlet to provide to the listeners - * - * @see AllocationAction#ITEM_ARRIVED - * @see AllocationAction#ITEM_SCHEDULED - * @see AllocationAction#ITEM_CANCELLED - * @see AllocationAction#ITEM_COMPLETED - * @see AllocationAction#ITEM_STATUS_CHANGED - * @see AllocationAction#SCHEDULE_CHANGED - */ - protected void notifyListeners(int allocationAction, boolean shouldPause, - ScheduleItem item) { - - if(!GridSim.isDebugModeEnabled()) - return; - - LinkedList<ScheduleItem> itemList = null; - if(item != null) { - itemList = new LinkedList<ScheduleItem>(); - itemList.add(item); - } - - notifyListeners(allocationAction, shouldPause, itemList); - } - - /** - * Notifies the listeners about the action performed - * @param allocationAction the action performed - * @param shouldPause indicates whether the simulation should be paused after - * notifying the listeners. <tt>true</tt> indicates that it should pause and - * <tt>false</tt> means that it should not. - * @param gridlet the gridlet to provide to the listeners - * - * @see AllocationAction#ITEM_ARRIVED - * @see AllocationAction#ITEM_SCHEDULED - * @see AllocationAction#ITEM_CANCELLED - * @see AllocationAction#ITEM_COMPLETED - * @see AllocationAction#ITEM_STATUS_CHANGED - * @see AllocationAction#SCHEDULE_CHANGED - */ - protected void notifyListeners(int allocationAction, boolean shouldPause) { - - if(!GridSim.isDebugModeEnabled()) - return; - - AllocationAction action = new AllocationAction(allocationAction); - action.setSubject(this.get_id()); - GridSimVisualizer.notifyListeners(action, shouldPause); - } - } // end class Modified: branches/gridsim4.0-branch3/source/gridsim/GridSim.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/GridSim.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/GridSim.java 2007-10-19 00:52:11 UTC (rev 75) @@ -17,8 +17,12 @@ import eduni.simjava.Sim_type_p; import gridsim.filter.FilterGridlet; import gridsim.filter.FilterResult; +import gridsim.gui.AllocationAction; +import gridsim.gui.AllocationListener; +import gridsim.gui.DefaultGridSimVisualizer; import gridsim.gui.GridSimVisualizer; import gridsim.net.Link; +import gridsim.turbo.ScheduleItem; import java.util.ArrayList; import java.util.Calendar; @@ -88,7 +92,8 @@ public static boolean debugMode_ = true; public static boolean slowMotionMode_ = false; public static boolean stepByStepMode_ = false; - + private static GridSimVisualizer visualizer_ = null; + /////////////////////////// STATIC variables //////////////////// /** @@ -448,7 +453,8 @@ } } - // METHODS TO SET THE SIMULATION MODES + // METHODS TO SET THE SIMULATION MODES AND NOTIFY THE GRAPHICAL + // USER INTERFACE ELEMENTS ABOUT ALLOCATION ACTIONS /** * Enables the debug mode (used by the GUI) @@ -509,8 +515,115 @@ public static void disableStepByStepMode() { stepByStepMode_ = false; } + + /** + * Sets the visualizer to be used by GridSim when the + * debug mode of simulation is enabled + * @param visualizer an object that implements {@link GridSimVisualizer} + * and is able to forward the allocation actions to the + * corresponding listeners + * @throws Exception is thrown if this method is called after the simulation + * has started. + */ + public static void setGridSimVisualizer(GridSimVisualizer visualizer) + throws Exception{ + + if(Sim_system.running()) { + throw new Exception("GridSim.setGridSimVisualizer(): Exception, it " + + "is not possible to change the visualizer once the simulation is running"); + } + else { + visualizer_ = visualizer; + } + } /** + * Notifies the listeners about the action performed + * @param subjectId the subject, or entity, that created the action + * @param allocationAction the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listeners. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @param itemList the list of gridlets to provide to the listeners + * + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED + * @see AllocationAction#SCHEDULE_CHANGED + */ + public static void notifyListeners(int subjectId, int allocationAction, + boolean shouldPause, LinkedList itemList) { + + if(!GridSim.isDebugModeEnabled()) + return; + + AllocationAction action = new AllocationAction(allocationAction); + action.setSubject(subjectId); + action.setScheduleItems(itemList); + visualizer_.notifyListeners(action, shouldPause); + } + + /** + * Notifies the listeners about the action performed + * @param subjectId the subject, or entity, that created the action + * @param allocationAction the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listeners. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @param item the gridlet to provide to the listeners + * + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED + * @see AllocationAction#SCHEDULE_CHANGED + */ + public static void notifyListeners(int subjectId, int allocationAction, + boolean shouldPause, ScheduleItem item) { + + if(!GridSim.isDebugModeEnabled()) + return; + + LinkedList<ScheduleItem> itemList = null; + if(item != null) { + itemList = new LinkedList<ScheduleItem>(); + itemList.add(item); + } + + notifyListeners(subjectId, allocationAction, shouldPause, itemList); + } + + /** + * Notifies the listeners about the action performed + * @param subjectId the subject, or entity, that created the action + * @param allocationAction the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listeners. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @param gridlet the gridlet to provide to the listeners + * + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED + * @see AllocationAction#SCHEDULE_CHANGED + */ + public static void notifyListeners(int subjectId, int allocationAction, + boolean shouldPause) { + + if(!GridSim.isDebugModeEnabled()) + return; + + AllocationAction action = new AllocationAction(allocationAction); + action.setSubject(subjectId); + visualizer_.notifyListeners(action, shouldPause); + } + + /** * Returns <tt>true</tt> if the step by step mode is enabled * @return <tt>true</tt> if the step by step mode is enabled; * <tt>false<tt> otherwise @@ -623,32 +736,17 @@ public static void startGridSimulation(boolean debug) throws NullPointerException { System.out.println("Starting GridSim " + GRIDSIM_VERSION_STRING); - if(!debug){ + if(!debug) { startGridSimulation(); } - else{ + else { enableDebugMode(); disableSlowMotionMode(); disableStepByStepMode(); - // get a list of resource created by the user in order to pass - // it to the visualisation tool - ArrayList<GridResource> resources = new ArrayList<GridResource>(); - LinkedList<Sim_entity> entities = Sim_system.getEntityList(); - for(Sim_entity entity : entities){ - if(entity instanceof GridResource){ - resources.add((GridResource)entity); - } - } - try { - // create the visualisation tool - GridSimVisualizer visualizer = new GridSimVisualizer(resources); - visualizer.setVisible(true); - } - catch (ParameterException e) { - throw new NullPointerException("GridSim.startGridSimulation() :" + - " Error - the visualiser could not be initialised."); - } + // create the visualisation tool + if(visualizer_ == null) + visualizer_ = new DefaultGridSimVisualizer(); } } Copied: branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java (from rev 73, branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java) =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-10-19 00:52:11 UTC (rev 75) @@ -0,0 +1,415 @@ +/******************************************************************************* + * Copyright (C) 2005-2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + *****************************************************************************/ +package gridsim.gui; + +import eduni.simjava.Sim_entity; +import eduni.simjava.Sim_system; +import gridsim.GridResource; +import gridsim.GridSim; +import gridsim.ResourceCharacteristics; + +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.border.Border; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +/** + * {@link GridSimVisualiser} is the class that represents the main window. + * used by the visualisation tool. From this window it is possible to + * start the simulation, run step by step or run it in slow motion. <br> + * <b>NOTE:</b> This visualisation tool should be used for debugging + * purposes only. It is useful if you want to evaluate a new allocation + * policy for example. A real experiment is not meant to have any + * visualisation features. This interface was initially created for + * another simulator called PajFit available at <b>http://pajfit.sourceforge.net/</b>. + * + * @author Marco A. S. Netto (created this visualisation tool) + * @author Marcos Dias de Assuncao (modified this class to be + * used by GridSim.) + * @since GridSim Turbo Alpha 0.1 + * + * @see gridsim.GridSim#startGridSimulation(boolean) + * @see gridsim.GridSim#startGridSimulation() + * @see gridsim.turbo.ParallelSpaceShared + * @see gridsim.turbo.ARTParallelSpaceShared + */ +public class DefaultGridSimVisualizer extends JFrame + implements ActionListener, ListSelectionListener, GridSimVisualizer { + + private static final long serialVersionUID = 2059324063853260682L; + public static final int WINDOW_WIDTH = 400; + public static final int WINDOW_HEIGHT = 350; + + private JButton stepButton_; + private JButton runButton_; + private JButton slowMotionButton_; + private JList resourceJList_; + private JList resourceInfoJList_; + + // the thread responsible for starting the simulation. This is needed + // because we do not want to buttons to remain blocked during the whole + // simulation process + private Thread simThread_; + + // indicates whether this is the first time the user + // is clicking a button of the graphical user interface + private boolean firstButtonClick_; + + // a table containing references to the resource windows. That is, + // each resource has a window that displays the content of the + // scheduling queue and the allocation actions performed + private HashMap<String, ResourceWindow> resourceWindows_ = null; + private ArrayList<GridResource> resources_ = null; + + // a list of all the allocation listeners in the system + private static LinkedHashMap<Integer, AllocationListener> listeners_; + + // constants to indicate the time unit to be used for displaying + // information + public static final int TIME_UNIT_SECOND = 0; + public static final int TIME_UNIT_MINUTE = 1; + public static final int TIME_UNIT_HOUR = 2; + + static { + listeners_ = new LinkedHashMap<Integer, AllocationListener>(); + } + + /** + * Creates the main window of the visualiser. + */ + public DefaultGridSimVisualizer() { + + // get a list of resource created by the user in order to pass + // it to the visualisation tool + resources_ = new ArrayList<GridResource>(); + LinkedList<Sim_entity> entities = Sim_system.getEntityList(); + for(Sim_entity entity : entities){ + if(entity instanceof GridResource){ + resources_.add((GridResource)entity); + } + } + + resourceWindows_ = new HashMap<String,ResourceWindow>(); + initResourceWindows(); + + super.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); + super.setLocation(10, 10); + super.setTitle("GridSim Turbo Alpha 0.1 Visualizer"); + + JPanel mainPanel = new JPanel(new GridLayout(0, 1)); + JPanel simulationPanel = new JPanel(new GridLayout(0, 2)); + + Border simulationBorder = BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(EtchedBorder.RAISED), "Simulation"); + simulationPanel.setBorder(simulationBorder); + + JPanel executionPanel = new JPanel(new GridLayout(3,0)); + executionPanel.setBorder(new TitledBorder("Execution")); + + stepButton_ = new JButton("Step"); + runButton_ = new JButton("Run"); + slowMotionButton_ = new JButton("Slow Motion"); + + stepButton_.addActionListener(this); + runButton_.addActionListener(this); + slowMotionButton_.addActionListener(this); + + executionPanel.add(stepButton_); + executionPanel.add(runButton_); + executionPanel.add(slowMotionButton_); + + ArrayList<String> resourceNames = new ArrayList<String>(); + for(GridResource resource : resources_){ + resourceNames.add(resource.get_name()); + } + + resourceJList_ = new JList(); + resourceJList_.setListData(resourceNames.toArray()); + resourceJList_.setBackground(this.getBackground()); + resourceJList_.addListSelectionListener(this); + + JPanel resourcePanel = new JPanel(new GridLayout(0, 1)); + resourcePanel.setBorder(new TitledBorder("Resources")); + JScrollPane scrollResourcePanel = new JScrollPane(resourceJList_); + resourcePanel.add(scrollResourcePanel); + + simulationPanel.add(executionPanel); + simulationPanel.add(resourcePanel); + + resourceInfoJList_ = new JList(); + resourceInfoJList_.setBackground(this.getBackground()); + + JPanel resourceInfoPanel = new JPanel(new GridLayout(0, 1)); + resourceInfoPanel.setBorder(new TitledBorder("Resource Details")); + resourceInfoPanel.add(resourceInfoJList_); + + Border resourceInfoBorder = BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(EtchedBorder.RAISED), "Resource Details"); + resourceInfoPanel.setBorder(resourceInfoBorder); + + mainPanel.add(simulationPanel); + mainPanel.add(resourceInfoPanel); + + createMenuBar(); + firstButtonClick_ = true; + + super.setLocation(0, 0); + super.getContentPane().add(mainPanel, BorderLayout.CENTER); + super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + // Creates a thread that will be responsible for starting the simulation + // I don't want to block the buttons during the whole simulation because + // they will be required for other things + simThread_ = new Thread(){ + public void run(){ + // here in fact, start the simulation + GridSim.startGridSimulation(); + } + }; + + super.setVisible(true); + } + + // ------------------------- PUBLIC METHODS ------------------------- + + /** + * Notifies a listener about the action performed + * @param action the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listener. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED + * @see AllocationAction#SCHEDULE_CHANGED + */ + public void notifyListeners(AllocationAction action, boolean shouldPause) { + AllocationListener listener = listeners_.get(action.getSubject()); + if(listener != null) { + listener.allocationActionPerformed(action); + informListenersAboutTime(); + + if(shouldPause){ + if(GridSim.isStepByStepEnabled()){ + GridSim.pauseSimulation(); + } + else if(GridSim.isSlowMotionModeEnabled()){ + GridSim.smallPause(); + } + } + } + } + + /** + * Adds a listener to the list of listeners interested in the events + * generated by a given entity + * @param entityId the id of the entity in which the listener is interested + * @param listener the listener to be registered + * @return <tt>true</tt> if success or <tt>false</tt> otherwise + */ + public static boolean addAllocationListener(int entityId, + AllocationListener listener) { + if(listeners_.containsKey(entityId)) + return false; + + listeners_.put(entityId, listener); + return true; + } + + /** + * Unregisters a listener from the list of listeners + * @param listener the listener to be unregistered + * @return <tt>true</tt> if success or <tt>false</tt> otherwise + */ + public static boolean removeAllocationListener(AllocationListener listener) { + if(!listeners_.containsValue(listener)){ + return false; + } + listeners_.remove(listener); + return true; + } + + /** + * Handles events triggered by the list of resource + */ + public void valueChanged(ListSelectionEvent ev) { + String selectedResource = (String) resourceJList_.getSelectedValue(); + updateResourceDetails(selectedResource); + } + + /** + * Handles the option that the user selected. + */ + public void actionPerformed(ActionEvent e){ + String cmd = e.getActionCommand(); + + if(cmd.equals("Step")){ + GridSim.enableStepByStepMode(); + GridSim.disableSlowMotionMode(); + + checkFirstClick(); + GridSim.resumeSimulation(); + } + else if(cmd.equals("Run")){ + GridSim.disableStepByStepMode(); + GridSim.disableSlowMotionMode(); + + if(!checkFirstClick()) { + GridSim.resumeSimulation(); + } + } + else if(cmd.equals("Slow Motion")){ + GridSim.disableStepByStepMode(); + GridSim.enableSlowMotionMode(); + + if(!checkFirstClick()) { + GridSim.resumeSimulation(); + } + } + else if(cmd.equals("Exit") ){ + System.exit(0); + } + else { + String resourceName = cmd; + ResourceWindow window = resourceWindows_.get(resourceName); + window.setVisible(true); + } + } + + // ------------------------- PRIVATE METHODS ------------------------- + + /** + * Informs all the listeners about the change in the + * simulation time + */ + private static void informListenersAboutTime() { + Iterator<AllocationListener> iterListener = listeners_.values().iterator(); + while(iterListener.hasNext()) { + AllocationListener listener = iterListener.next(); + AllocationAction action = + new AllocationAction(AllocationAction.SIMULATION_TIME_CHANGED); + listener.allocationActionPerformed(action); + } + } + + /** + * This method initialises the resource windows + */ + private void initResourceWindows() { + int windowId = 0; + for(GridResource resource : resources_){ + GridResource tresource = (GridResource)resource; + ResourceWindow window = new ResourceWindow(resource, windowId); + resourceWindows_.put(resource.get_name(), window); + + // registers the window as an allocation listener + // of the allocation policy. This means that the window will be + // notified of the allocation actions performed by the resource + // allocation policy + listeners_.put(tresource.getAllocationPolicy().get_id(), window); + windowId++; + } + } + + /** + * Creates the menu bar of the main window + */ + private void createMenuBar() { + JMenuBar menuBar = new JMenuBar(); + JMenu menuCommand = new JMenu("Start"); + JMenuItem item; + + for(GridResource rs : resources_){ + item = new JMenuItem(rs.get_name()); + item.addActionListener(this); + menuCommand.add(item); + } + + menuCommand.addSeparator(); + item = new JMenuItem("Exit"); + item.addActionListener(this); + menuCommand.add(item); + menuBar.add(menuCommand); + setJMenuBar(menuBar); + } + + /** + * This method checks whether this is the first time that a + * button is clicked. If so, then the simulation has to be + * started. + * @return <tt>true</tt> if it was the first click or + * <tt>false</tt> otherwise. + */ + private boolean checkFirstClick() { + if(firstButtonClick_){ + firstButtonClick_ = false; + simThread_.start(); + return true; + } + return false; + } + + /** + * Updates the details about the resource + */ + private void updateResourceDetails(String resourceName) { + GridResource resource = null; + Iterator<GridResource> iterResources = resources_.iterator(); + while(iterResources.hasNext()) { + resource = iterResources.next(); + if(resource.get_name().equals(resourceName)) + break; + } + + if(resource == null) + return; + + DefaultListModel model = new DefaultListModel(); + ResourceCharacteristics charact = resource.getResourceCharacteristics(); + model.addElement("Resource ID: " + charact.getResourceID()); + model.addElement("Number of PEs: " + charact.getNumPE()); + model.addElement("Allocation Policy: " + charact.getResourceAllocationPolicyName()); + model.addElement("Time Zone: " + charact.getResourceTimeZone()); + model.addElement("Rating per PE: " + charact.getMIPSRatingOfOnePE() + " MIPS"); + resourceInfoJList_.setModel(model); + } +} Added: branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-19 00:52:11 UTC (rev 75) @@ -0,0 +1,26 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package gridsim.gui; + +public interface GridSimVisualizer { + + /** + * Notifies a listener about the action performed + * @param action the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listener. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED + * @see AllocationAction#SCHEDULE_CHANGED + */ + void notifyListeners(AllocationAction action, boolean shouldPause); +} Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-19 00:52:11 UTC (rev 75) @@ -155,7 +155,7 @@ super.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); drawID_ = true; - timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND; + timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_SECOND; // initialises the list of Gridlets scheduledItems_ = new ArrayList<ScheduleItem>(); @@ -164,7 +164,7 @@ initPanels(); super.addComponentListener(new ResizeFrame(this)); - super.setLocation(GridSimVisualizer.WINDOW_WIDTH, windowId * 200); + super.setLocation(DefaultGridSimVisualizer.WINDOW_WIDTH, windowId * 200); super.setTitle("Resource Information Window - " + resource_.getResourceCharacteristics().getResourceName()); } @@ -235,19 +235,19 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == secondButton_) { if(secondButton_.isSelected()) { - timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND; + timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_SECOND; itemPanel_.updatePanel(); } } else if (e.getSource() == minuteButton_) { if(minuteButton_.isSelected()) { - timeUnit_ = GridSimVisualizer.TIME_UNIT_MINUTE; + timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_MINUTE; itemPanel_.updatePanel(); } } else if (e.getSource() == hourButton_) { if(hourButton_.isSelected()) { - timeUnit_ = GridSimVisualizer.TIME_UNIT_HOUR; + timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_HOUR; itemPanel_.updatePanel(); } } @@ -402,10 +402,10 @@ * @return the time in the unit in use */ private double convertToUnitInUse(double time) { - if(timeUnit_ == GridSimVisualizer.TIME_UNIT_SECOND) { + if(timeUnit_ == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { return time; } - else if(timeUnit_ == GridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit_ == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { return time/60; } else { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-19 00:52:11 UTC (rev 75) @@ -308,7 +308,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- // informs the listeners that a reservation request has arrived - super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sRes); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_ARRIVED, true, sRes); //---------------------------------------------------------- @@ -455,7 +455,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- // Informs the listeners about the reservation that has been created - super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sRes); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sRes); //---------------------------------------------------------- } @@ -522,7 +522,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, sRes); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_CANCELLED, true, sRes); //---------------------------------------------------------------------- @@ -532,7 +532,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // Inform the listeners about the new schedule - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); + GridSim.notifyListeners(this.get_id(), AllocationAction.SCHEDULE_CHANGED, true); //---------------------------------------------------------------------- @@ -611,7 +611,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- - super.notifyListeners(AllocationAction.ITEM_STATUS_CHANGED, true, sRes); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_STATUS_CHANGED, true, sRes); //---------------------------------------------------------- } @@ -829,7 +829,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_CANCELLED, true, sgl); //---------------------------------------------------------------------- @@ -842,7 +842,7 @@ //------------------- USED FOR DEBUGGING PURPOSES ONLY ----------------- // Inform the listeners about the new schedule - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); + GridSim.notifyListeners(this.get_id(), AllocationAction.SCHEDULE_CHANGED, true); //---------------------------------------------------------------------- @@ -1009,7 +1009,7 @@ //------------------ FOR DEBUGGING PURPOSES ONLY------------------------ - super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_ARRIVED, true, sgl); //---------------------------------------------------------------------- @@ -1034,7 +1034,7 @@ // Notifies the listeners that a Gridlet has been either scheduled // to run immediately or put in the waiting queue - super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sgl); //--------------------------------------------------------------- @@ -1072,7 +1072,7 @@ /////////////// FOR DEBUGGING PURPOSES ONLY //////// - super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_ARRIVED, true, sgl); ///////////////////////////////////////////////////// @@ -1152,7 +1152,7 @@ // Notifies the listeners that a Gridlet has been either scheduled // to run immediately or put in the waiting queue - super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sgl); //--------------------------------------------------------------- @@ -1314,7 +1314,7 @@ //---------------- USED FOR DEBUGGING PURPOSES ONLY ---------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.ITEM_CANCELLED, + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_CANCELLED, false, removedGridlets); //------------------------------------------------------------------ @@ -1520,7 +1520,7 @@ //-------------- USED FOR DEBUGGING PURPOSES ONLY ----------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, removedRes); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_CANCELLED, true, removedRes); //----------------------------------------------------------------- @@ -1537,7 +1537,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); + GridSim.notifyListeners(this.get_id(), AllocationAction.SCHEDULE_CHANGED, true); //----------------------------------------------------------------- } @@ -1597,7 +1597,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners if(gridletStarted > 0 || gridletFinished > 0){ - super.notifyListeners(AllocationAction.ITEM_COMPLETED, + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_COMPLETED, true, grlsCompleted); } } @@ -1648,7 +1648,7 @@ //------------- USED FOR DEBUGGING PURPOSES ONLY ------------------ // notify the listeners - super.notifyListeners(AllocationAction.ITEM_STATUS_CHANGED, + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_STATUS_CHANGED, true, startedReservations); //------------------------------------------------------------------ @@ -1659,7 +1659,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); + GridSim.notifyListeners(this.get_id(), AllocationAction.SCHEDULE_CHANGED, true); //------------------------------------------------------------------ } @@ -1706,7 +1706,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); + GridSim.notifyListeners(this.get_id(), AllocationAction.SCHEDULE_CHANGED, true); //----------------------------------------------------------------- } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-19 00:52:11 UTC (rev 75) @@ -234,7 +234,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- - super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_ARRIVED, true, sgl); //---------------------------------------------------------- @@ -259,7 +259,7 @@ // Notifies the listeners that a Gridlet has been either scheduled // to run immediately or put in the waiting queue - super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sgl); //--------------------------------------------------------------- @@ -397,7 +397,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // If a gridlet has been cancelled, then inform the listeners about it - super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, sgl); + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_CANCELLED, true, sgl); //---------------------------------------------------------------------- @@ -407,7 +407,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // Inform the listeners about the new schedule - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); + GridSim.notifyListeners(this.get_id(), AllocationAction.SCHEDULE_CHANGED, true); //---------------------------------------------------------------------- @@ -959,7 +959,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners if(gridletStarted > 0 || gridletFinished > 0){ - super.notifyListeners(AllocationAction.ITEM_COMPLETED, + GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_COMPLETED, true, grlsCompleted); } //---------------------------------------------------------------------- Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-19 00:52:11 UTC (rev 75) @@ -11,7 +11,7 @@ import gridsim.GridSim; import gridsim.Gridlet; -import gridsim.gui.GridSimVisualizer; +import gridsim.gui.DefaultGridSimVisualizer; /** * GridSim @link{SSGridlet} represents a Gridlet submitted to @@ -436,9 +436,9 @@ * Creates a String representation of this Gridlet * for displaying purposes * @param timeUnit the time unit to be used - * @see GridSimVisualizer#TIME_UNIT_SECOND - * @see GridSimVisualizer#TIME_UNIT_MINUTE - * @see GridSimVisualizer#TIME_UNIT_HOUR + * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND + * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE + * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR */ public String toString(int timeUnit){ String unitDesc = getTimeUnitDescription(timeUnit); @@ -491,10 +491,10 @@ * @return the string containing the description */ private String getTimeUnitDescription(int timeUnit) { - if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) { + if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { return "sec."; } - else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { return "min."; } else { @@ -508,10 +508,10 @@ * @return the time in the unit in use */ private double convertToUnitInUse(double time, int timeUnit) { - if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) { + if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { return time; } - else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { return time/60; } else { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-19 00:52:11 UTC (rev 75) @@ -7,7 +7,7 @@ package gridsim.turbo; -import gridsim.gui.GridSimVisualizer; +import gridsim.gui.DefaultGridSimVisualizer; import java.text.DecimalFormat; import java.util.Calendar; @@ -345,9 +345,9 @@ * for displaying purposes * @param timeUnit the time unit to be used * @return the string representation - * @see GridSimVisualizer#TIME_UNIT_SECOND - * @see GridSimVisualizer#TIME_UNIT_MINUTE - * @see GridSimVisualizer#TIME_UNIT_HOUR + * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND + * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE + * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR */ public String toString(int timeUnit) { String unitDesc = getTimeUnitDescription(timeUnit); @@ -372,7 +372,7 @@ * @return the string representation */ public String toString() { - return toString(GridSimVisualizer.TIME_UNIT_SECOND); + return toString(DefaultGridSimVisualizer.TIME_UNIT_SECOND); } /** @@ -382,10 +382,10 @@ * @return the string containing the description */ private static String getTimeUnitDescription(int timeUnit) { - if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) { + if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { return "sec."; } - else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { return "min."; } else { @@ -399,10 +399,10 @@ * @return the time in the unit in use */ private static double convertToUnitInUse(double time, int timeUnit) { - if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) { + if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) { return time; } - else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) { + else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) { return time/60; } else { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-19 00:51:28 UTC (rev 74) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-19 00:52:11 UTC (rev 75) @@ -7,7 +7,7 @@ package gridsim.turbo; -import gridsim.gui.GridSimVisualizer; +import gridsim.gui.DefaultGridSimVisualizer; import gridsim.gui.ResourceWindow; /** @@ -98,9 +98,9 @@ * Creates a String representation of this item * for displaying purposes * @param timeUnit the time unit to be used - * @see GridSimVisualizer#TIME_UNIT_SECOND - * @see GridSimVisualizer#TIME_UNIT_MINUTE - * @see GridSimVisualizer#TIME_UNIT_HOUR + * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND + * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE + * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR */ public String toString(int timeUnit); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-19 00:51:28
|
Revision: 74 http://gridsim.svn.sourceforge.net/gridsim/?rev=74&view=rev Author: marcos_dias Date: 2007-10-18 17:51:28 -0700 (Thu, 18 Oct 2007) Log Message: ----------- This update is to allow the user to change the default Graphical User Interface used by GridSim and provide his/her own. Removed Paths: ------------- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java Deleted: branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-18 06:20:07 UTC (rev 73) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-19 00:51:28 UTC (rev 74) @@ -1,407 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2005-2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - *****************************************************************************/ -package gridsim.gui; - -import gridsim.GridResource; -import gridsim.GridSim; -import gridsim.ParameterException; -import gridsim.ResourceCharacteristics; - -import java.awt.BorderLayout; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; - -import javax.swing.BorderFactory; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JList; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.border.Border; -import javax.swing.border.EtchedBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -/** - * {@link GridSimVisualiser} is the class that represents the main window. - * used by the visualisation tool. From this window it is possible to - * start the simulation, run step by step or run it in slow motion. <br> - * <b>NOTE:</b> This visualisation tool should be used for debugging - * purposes only. It is useful if you want to evaluate a new allocation - * policy for example. A real experiment is not meant to have any - * visualisation features. This interface was initially created for - * another simulator called PajFit available at <b>http://pajfit.sourceforge.net/</b>. - * - * @author Marco A. S. Netto (created this visualisation tool) - * @author Marcos Dias de Assuncao (modified this class to be - * used by GridSim.) - * @since GridSim Turbo Alpha 0.1 - * - * @see gridsim.GridSim#startGridSimulation(boolean) - * @see gridsim.GridSim#startGridSimulation() - * @see gridsim.turbo.ParallelSpaceShared - * @see gridsim.turbo.ARTParallelSpaceShared - */ -public class GridSimVisualizer extends JFrame - implements ActionListener, ListSelectionListener { - - private static final long serialVersionUID = 2059324063853260682L; - public static final int WINDOW_WIDTH = 400; - public static final int WINDOW_HEIGHT = 350; - - private JButton stepButton_; - private JButton runButton_; - private JButton slowMotionButton_; - private JList resourceJList_; - private JList resourceInfoJList_; - - // the thread responsible for starting the simulation. This is needed - // because we do not want to buttons to remain blocked during the whole - // simulation process - private Thread simThread_; - - // indicates whether this is the first time the user - // is clicking a button of the graphical user interface - private boolean firstButtonClick_; - - // a table containing references to the resource windows. That is, - // each resource has a window that displays the content of the - // scheduling queue and the allocation actions performed - private HashMap<String, ResourceWindow> resourceWindows_ = null; - private ArrayList<GridResource> resources_ = null; - - // a list of all the allocation listeners in the system - private static LinkedHashMap<Integer, AllocationListener> listeners_; - - // constants to indicate the time unit to be used for displaying - // information - public static final int TIME_UNIT_SECOND = 0; - public static final int TIME_UNIT_MINUTE = 1; - public static final int TIME_UNIT_HOUR = 2; - - static { - listeners_ = new LinkedHashMap<Integer, AllocationListener>(); - } - - /** - * Creates the main window of the visualiser. - * @param resources a list of the {@link GridResource} entities created - * during the simulation process - * @throws ParameterException if the simulation has been started - * as debug mode and no resources have been created - */ - public GridSimVisualizer(ArrayList<GridResource> resources) - throws ParameterException { - - resources_ = resources; - resourceWindows_ = new HashMap<String,ResourceWindow>(); - initResourceWindows(); - - super.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); - super.setLocation(10, 10); - super.setTitle("GridSim Turbo Alpha 0.1 Visualizer"); - - JPanel mainPanel = new JPanel(new GridLayout(0, 1)); - JPanel simulationPanel = new JPanel(new GridLayout(0, 2)); - - Border simulationBorder = BorderFactory.createTitledBorder( - BorderFactory.createEtchedBorder(EtchedBorder.RAISED), "Simulation"); - simulationPanel.setBorder(simulationBorder); - - JPanel executionPanel = new JPanel(new GridLayout(3,0)); - executionPanel.setBorder(new TitledBorder("Execution")); - - stepButton_ = new JButton("Step"); - runButton_ = new JButton("Run"); - slowMotionButton_ = new JButton("Slow Motion"); - - stepButton_.addActionListener(this); - runButton_.addActionListener(this); - slowMotionButton_.addActionListener(this); - - executionPanel.add(stepButton_); - executionPanel.add(runButton_); - executionPanel.add(slowMotionButton_); - - ArrayList<String> resourceNames = new ArrayList<String>(); - for(GridResource resource : resources_){ - resourceNames.add(resource.get_name()); - } - - resourceJList_ = new JList(); - resourceJList_.setListData(resourceNames.toArray()); - resourceJList_.setBackground(this.getBackground()); - resourceJList_.addListSelectionListener(this); - - JPanel resourcePanel = new JPanel(new GridLayout(0, 1)); - resourcePanel.setBorder(new TitledBorder("Resources")); - JScrollPane scrollResourcePanel = new JScrollPane(resourceJList_); - resourcePanel.add(scrollResourcePanel); - - simulationPanel.add(executionPanel); - simulationPanel.add(resourcePanel); - - resourceInfoJList_ = new JList(); - resourceInfoJList_.setBackground(this.getBackground()); - - JPanel resourceInfoPanel = new JPanel(new GridLayout(0, 1)); - resourceInfoPanel.setBorder(new TitledBorder("Resource Details")); - resourceInfoPanel.add(resourceInfoJList_); - - Border resourceInfoBorder = BorderFactory.createTitledBorder( - BorderFactory.createEtchedBorder(EtchedBorder.RAISED), "Resource Details"); - resourceInfoPanel.setBorder(resourceInfoBorder); - - mainPanel.add(simulationPanel); - mainPanel.add(resourceInfoPanel); - - createMenuBar(); - firstButtonClick_ = true; - - super.setLocation(0, 0); - super.getContentPane().add(mainPanel, BorderLayout.CENTER); - super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - // Creates a thread that will be responsible for starting the simulation - // I don't want to block the buttons during the whole simulation because - // they will be required for other things - simThread_ = new Thread(){ - public void run(){ - // here in fact, start the simulation - GridSim.startGridSimulation(); - } - }; - } - - // ------------------------- PUBLIC METHODS ------------------------- - - /** - * Notifies a listener about the action performed - * @param action the action performed - * @param shouldPause indicates whether the simulation should be paused after - * notifying the listener. <tt>true</tt> indicates that it should pause and - * <tt>false</tt> means that it should not. - * @see AllocationAction#ITEM_ARRIVED - * @see AllocationAction#ITEM_SCHEDULED - * @see AllocationAction#ITEM_CANCELLED - * @see AllocationAction#ITEM_COMPLETED - * @see AllocationAction#ITEM_STATUS_CHANGED - * @see AllocationAction#SCHEDULE_CHANGED - */ - public static void notifyListeners(AllocationAction action, boolean shouldPause) { - AllocationListener listener = listeners_.get(action.getSubject()); - if(listener != null) { - listener.allocationActionPerformed(action); - informListenersAboutTime(); - - if(shouldPause){ - if(GridSim.isStepByStepEnabled()){ - GridSim.pauseSimulation(); - } - else if(GridSim.isSlowMotionModeEnabled()){ - GridSim.smallPause(); - } - } - } - } - - /** - * Adds a listener to the list of listeners interested in the events - * generated by a given entity - * @param entityId the id of the entity in which the listener is interested - * @param listener the listener to be registered - * @return <tt>true</tt> if success or <tt>false</tt> otherwise - */ - public static boolean addAllocationListener(int entityId, - AllocationListener listener) { - if(listeners_.containsKey(entityId)) - return false; - - listeners_.put(entityId, listener); - return true; - } - - /** - * Unregisters a listener from the list of listeners - * @param listener the listener to be unregistered - * @return <tt>true</tt> if success or <tt>false</tt> otherwise - */ - public static boolean removeAllocationListener(AllocationListener listener) { - if(!listeners_.containsValue(listener)){ - return false; - } - listeners_.remove(listener); - return true; - } - - /** - * Handles events triggered by the list of resource - */ - public void valueChanged(ListSelectionEvent ev) { - String selectedResource = (String) resourceJList_.getSelectedValue(); - updateResourceDetails(selectedResource); - } - - /** - * Handles the option that the user selected. - */ - public void actionPerformed(ActionEvent e){ - String cmd = e.getActionCommand(); - - if(cmd.equals("Step")){ - GridSim.enableStepByStepMode(); - GridSim.disableSlowMotionMode(); - - checkFirstClick(); - GridSim.resumeSimulation(); - } - else if(cmd.equals("Run")){ - GridSim.disableStepByStepMode(); - GridSim.disableSlowMotionMode(); - - if(!checkFirstClick()) { - GridSim.resumeSimulation(); - } - } - else if(cmd.equals("Slow Motion")){ - GridSim.disableStepByStepMode(); - GridSim.enableSlowMotionMode(); - - if(!checkFirstClick()) { - GridSim.resumeSimulation(); - } - } - else if(cmd.equals("Exit") ){ - System.exit(0); - } - else { - String resourceName = cmd; - ResourceWindow window = resourceWindows_.get(resourceName); - window.setVisible(true); - } - } - - // ------------------------- PRIVATE METHODS ------------------------- - - /** - * Informs all the listeners about the change in the - * simulation time - */ - private static void informListenersAboutTime() { - Iterator<AllocationListener> iterListener = listeners_.values().iterator(); - while(iterListener.hasNext()) { - AllocationListener listener = iterListener.next(); - AllocationAction action = - new AllocationAction(AllocationAction.SIMULATION_TIME_CHANGED); - listener.allocationActionPerformed(action); - } - } - - /** - * This method initialises the resource windows - */ - private void initResourceWindows() { - int windowId = 0; - for(GridResource resource : resources_){ - GridResource tresource = (GridResource)resource; - ResourceWindow window = new ResourceWindow(resource, windowId); - resourceWindows_.put(resource.get_name(), window); - - // registers the window as an allocation listener - // of the allocation policy. This means that the window will be - // notified of the allocation actions performed by the resource - // allocation policy - listeners_.put(tresource.getAllocationPolicy().get_id(), window); - windowId++; - } - } - - /** - * Creates the menu bar of the main window - */ - private void createMenuBar() { - JMenuBar menuBar = new JMenuBar(); - JMenu menuCommand = new JMenu("Start"); - JMenuItem item; - - for(GridResource rs : resources_){ - item = new JMenuItem(rs.get_name()); - item.addActionListener(this); - menuCommand.add(item); - } - - menuCommand.addSeparator(); - item = new JMenuItem("Exit"); - item.addActionListener(this); - menuCommand.add(item); - menuBar.add(menuCommand); - setJMenuBar(menuBar); - } - - /** - * This method checks whether this is the first time that a - * button is clicked. If so, then the simulation has to be - * started. - * @return <tt>true</tt> if it was the first click or - * <tt>false</tt> otherwise. - */ - private boolean checkFirstClick() { - if(firstButtonClick_){ - firstButtonClick_ = false; - simThread_.start(); - return true; - } - return false; - } - - /** - * Updates the details about the resource - */ - private void updateResourceDetails(String resourceName) { - GridResource resource = null; - Iterator<GridResource> iterResources = resources_.iterator(); - while(iterResources.hasNext()) { - resource = iterResources.next(); - if(resource.get_name().equals(resourceName)) - break; - } - - if(resource == null) - return; - - DefaultListModel model = new DefaultListModel(); - ResourceCharacteristics charact = resource.getResourceCharacteristics(); - model.addElement("Resource ID: " + charact.getResourceID()); - model.addElement("Number of PEs: " + charact.getNumPE()); - model.addElement("Allocation Policy: " + charact.getResourceAllocationPolicyName()); - model.addElement("Time Zone: " + charact.getResourceTimeZone()); - model.addElement("Rating per PE: " + charact.getMIPSRatingOfOnePE() + " MIPS"); - resourceInfoJList_.setModel(model); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-18 06:20:05
|
Revision: 73 http://gridsim.svn.sourceforge.net/gridsim/?rev=73&view=rev Author: marcos_dias Date: 2007-10-17 23:20:07 -0700 (Wed, 17 Oct 2007) Log Message: ----------- A bug that prevents the current time from being updated pproperly in all resource windows has been fixed. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/GridSim.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java Removed Paths: ------------- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java Modified: branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2007-10-18 06:20:07 UTC (rev 73) @@ -9,7 +9,6 @@ package gridsim; -import java.util.ArrayList; import java.util.Calendar; import java.util.LinkedList; @@ -17,8 +16,7 @@ import eduni.simjava.Sim_event; import eduni.simjava.Sim_port; import gridsim.gui.AllocationAction; -import gridsim.gui.AllocationListener; -import gridsim.gui.AllocationSubject; +import gridsim.gui.GridSimVisualizer; import gridsim.turbo.ScheduleItem; /** @@ -43,8 +41,7 @@ * @see gridsim.ResourceCharacteristics * @invariant $none */ -public abstract class AllocPolicy extends Sim_entity - implements AllocationSubject { +public abstract class AllocPolicy extends Sim_entity { /** The GridResource characteristics object, same as the one in * GridResource class @@ -87,10 +84,6 @@ private boolean endSimulation_; // denotes the end of simulation private final int ARRAY_SIZE = 2; // [0] = gridlet id and [1] = result - // FOR DEBUGGING PURPOSES ONLY - private ArrayList<AllocationListener> listeners_; // the listeners interested in this policy - private boolean hasListener_; // indicates whether there are listeners registered - ///////////////////// ABSTRACT METHODS ///////////////////////////// /** @@ -678,45 +671,6 @@ super.sim_schedule(myId_, time, tag, data); return true; } - - /** - * Adds a listener to the list of listeners interested in the events - * generated by this allocation policy - * @param listener the listener to be registered - * @return <tt>true</tt> if success or <tt>false</tt> otherwise - */ - public boolean addAllocationListener(AllocationListener listener) { - if(listeners_ == null){ - listeners_ = new ArrayList<AllocationListener>(); - listeners_.add(listener); - } - else{ - if(listeners_.contains(listener)){ - return false; - } - listeners_.add(listener); - } - hasListener_ = true; - return true; - } - - - /** - * Unregisters a listener from the list of listeners interested in - * the events generated by this allocation policy - * @param listener the listener to be unregistered - * @return <tt>true</tt> if success or <tt>false</tt> otherwise - */ - public boolean removeAllocationListener(AllocationListener listener) { - if(listeners_ == null || !listeners_.contains(listener)){ - return false; - } - listeners_.remove(listener); - if(listeners_.size() == 0) { - hasListener_ = false; - } - return true; - } /** * Notifies the listeners about the action performed @@ -724,40 +678,25 @@ * @param shouldPause indicates whether the simulation should be paused after * notifying the listeners. <tt>true</tt> indicates that it should pause and * <tt>false</tt> means that it should not. - * @param time the time when the action took place * @param itemList the list of gridlets to provide to the listeners * - * @see AllocationAction#GRIDLET_ARRIVED - * @see AllocationAction#GRIDLET_SCHEDULED - * @see AllocationAction#GRIDLET_CANCELLED - * @see AllocationAction#GRIDLET_COMPLETED + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED * @see AllocationAction#SCHEDULE_CHANGED */ - protected void notifyListeners(int allocationAction, boolean shouldPause, - double time, LinkedList itemList){ + protected void notifyListeners(int allocationAction, + boolean shouldPause, LinkedList itemList) { - if(!GridSim.DEBUG_SIMULATION) + if(!GridSim.isDebugModeEnabled()) return; - if(hasListener_){ - AllocationAction action = new AllocationAction(allocationAction, time); - - if(itemList != null) - action.setScheduleItems(itemList); - - for(AllocationListener listener : listeners_){ - listener.allocationActionPerformed(action); - } - - if(shouldPause){ - if(GridSim.STEP_BY_STEP_SIMULATION){ - GridSim.pauseSimulation(); - } - else if(GridSim.SLOW_MOTION_SIMULATION){ - GridSim.smallPause(); - } - } - } + AllocationAction action = new AllocationAction(allocationAction); + action.setSubject(this.get_id()); + action.setScheduleItems(itemList); + GridSimVisualizer.notifyListeners(action, shouldPause); } /** @@ -766,19 +705,19 @@ * @param shouldPause indicates whether the simulation should be paused after * notifying the listeners. <tt>true</tt> indicates that it should pause and * <tt>false</tt> means that it should not. - * @param time the time when the action took place * @param item the gridlet to provide to the listeners * - * @see AllocationAction#GRIDLET_ARRIVED - * @see AllocationAction#GRIDLET_SCHEDULED - * @see AllocationAction#GRIDLET_CANCELLED - * @see AllocationAction#GRIDLET_COMPLETED + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED * @see AllocationAction#SCHEDULE_CHANGED */ protected void notifyListeners(int allocationAction, boolean shouldPause, - double time, ScheduleItem item){ + ScheduleItem item) { - if(!GridSim.DEBUG_SIMULATION) + if(!GridSim.isDebugModeEnabled()) return; LinkedList<ScheduleItem> itemList = null; @@ -787,7 +726,7 @@ itemList.add(item); } - notifyListeners(allocationAction, shouldPause, time, itemList); + notifyListeners(allocationAction, shouldPause, itemList); } /** @@ -796,36 +735,23 @@ * @param shouldPause indicates whether the simulation should be paused after * notifying the listeners. <tt>true</tt> indicates that it should pause and * <tt>false</tt> means that it should not. - * @param time the time when the action took place * @param gridlet the gridlet to provide to the listeners * - * @see AllocationAction#GRIDLET_ARRIVED - * @see AllocationAction#GRIDLET_SCHEDULED - * @see AllocationAction#GRIDLET_CANCELLED - * @see AllocationAction#GRIDLET_COMPLETED + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED * @see AllocationAction#SCHEDULE_CHANGED */ - protected void notifyListeners(int allocationAction, boolean shouldPause, double time){ + protected void notifyListeners(int allocationAction, boolean shouldPause) { - if(!GridSim.DEBUG_SIMULATION) + if(!GridSim.isDebugModeEnabled()) return; - if(hasListener_){ - AllocationAction action = new AllocationAction(allocationAction, time); - - for(AllocationListener listener : listeners_){ - listener.allocationActionPerformed(action); - } - - if(shouldPause){ - if(GridSim.STEP_BY_STEP_SIMULATION){ - GridSim.pauseSimulation(); - } - else if(GridSim.SLOW_MOTION_SIMULATION){ - GridSim.smallPause(); - } - } - } + AllocationAction action = new AllocationAction(allocationAction); + action.setSubject(this.get_id()); + GridSimVisualizer.notifyListeners(action, shouldPause); } } // end class Modified: branches/gridsim4.0-branch3/source/gridsim/GridSim.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/GridSim.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/GridSim.java 2007-10-18 06:20:07 UTC (rev 73) @@ -83,10 +83,11 @@ private final int SIZE = 12; // Integer object size incl. overhead private final int RESULT = 1; // array[0] = gridlet id, [1] = result private final static String GRIDSIM_VERSION_STRING = "Turbo Alpha 0.1"; - public static boolean END_OF_SIMULATION = false; - public static boolean DEBUG_SIMULATION = true; - public static boolean SLOW_MOTION_SIMULATION = false; - public static boolean STEP_BY_STEP_SIMULATION = false; + + // These attributes are set to be used by the Graphical User Interface + public static boolean debugMode_ = true; + public static boolean slowMotionMode_ = false; + public static boolean stepByStepMode_ = false; /////////////////////////// STATIC variables //////////////////// @@ -446,6 +447,77 @@ System.out.println( e.getMessage() ); } } + + // METHODS TO SET THE SIMULATION MODES + + /** + * Enables the debug mode (used by the GUI) + */ + public static void enableDebugMode() { + debugMode_ = true; + } + + /** + * Disables the debug mode (used by the GUI) + */ + public static void disableDebugMode() { + debugMode_ = false; + } + + /** + * Returns <tt>true</tt> if the debug mode is enabled + * @return <tt>true</tt> if the debug mode is enabled; + * <tt>false<tt> otherwise + */ + public static boolean isDebugModeEnabled() { + return debugMode_; + } + + /** + * Enables the slow motion mode (used by the GUI) + */ + public static void enableSlowMotionMode() { + slowMotionMode_ = true; + } + + /** + * Disables the slow motion mode (used by the GUI) + */ + public static void disableSlowMotionMode() { + slowMotionMode_ = false; + } + + /** + * Returns <tt>true</tt> if the slow motion mode is enabled + * @return <tt>true</tt> if the slow motion mode is enabled; + * <tt>false<tt> otherwise + */ + public static boolean isSlowMotionModeEnabled() { + return slowMotionMode_; + } + + /** + * Enables the step by step mode (used by the GUI) + */ + public static void enableStepByStepMode() { + stepByStepMode_ = true; + } + + /** + * Disables the step by step mode (used by the GUI) + */ + public static void disableStepByStepMode() { + stepByStepMode_ = false; + } + + /** + * Returns <tt>true</tt> if the step by step mode is enabled + * @return <tt>true</tt> if the step by step mode is enabled; + * <tt>false<tt> otherwise + */ + public static boolean isStepByStepEnabled() { + return stepByStepMode_; + } /** * Sets a <tt>GridInformationService</tt> (GIS) entity. @@ -524,7 +596,6 @@ System.out.println("Starting GridSim " + GRIDSIM_VERSION_STRING); try { Sim_system.run(); - END_OF_SIMULATION = true; } catch (Sim_exception e) { throw new NullPointerException("GridSim.startGridSimulation() :" + @@ -556,9 +627,9 @@ startGridSimulation(); } else{ - DEBUG_SIMULATION = true; - SLOW_MOTION_SIMULATION = false; - STEP_BY_STEP_SIMULATION = false; + enableDebugMode(); + disableSlowMotionMode(); + disableStepByStepMode(); // get a list of resource created by the user in order to pass // it to the visualisation tool Modified: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java 2007-10-18 06:20:07 UTC (rev 73) @@ -24,32 +24,26 @@ public class AllocationAction { private LinkedList<ScheduleItem> items_; + + // the id of the entity that generated this action + private int subject_; private int actionType_; - private double time_; - /** Gridlet related actions */ - public static final int GRIDLET_ARRIVED = 0; - public static final int GRIDLET_SCHEDULED = 1; - public static final int GRIDLET_COMPLETED = 2; - public static final int GRIDLET_CANCELLED = 3; - public static final int SCHEDULE_CHANGED = 4; + /** Possible allocation actions */ + public static final int ITEM_ARRIVED = 0; + public static final int ITEM_SCHEDULED = 1; + public static final int ITEM_COMPLETED = 2; + public static final int ITEM_CANCELLED = 3; + public static final int ITEM_STATUS_CHANGED = 4; + public static final int SCHEDULE_CHANGED = 5; + public static final int SIMULATION_TIME_CHANGED = 6; - /** Advance reservation actions */ - public static final int RESERVATION_ARRIVED = 10; - public static final int RESERVATION_SCHEDULED = 11; - public static final int RESERVATION_COMMITED = 12; - public static final int RESERVATION_STARTED = 13; - public static final int RESERVATION_CANCELLED = 14; - public static final int RESERVATION_FINISHED = 15; - /** * Creates a new {@link AllocationAction} object. * @param type the type of action performed - * @param time the time when the action was performed */ - public AllocationAction(int type, double time){ + public AllocationAction(int type){ actionType_ = type; - time_ = time; items_ = null; } @@ -92,18 +86,18 @@ } /** - * Gets the time associated with this action - * @return the time + * Gets the id of the subject or entity that created this action + * @return the id of the subject or entity that created this action */ - public double getTime() { - return time_; + public int getSubject() { + return subject_; } /** - * Sets the time associated with this action - * @param time the time + * Sets the id of the subject or entity that created this action + * @param subject the id of the subject or entity that created this action */ - public void setTime(double time) { - this.time_ = time; + public void setSubject(int subject) { + subject_ = subject; } } Deleted: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java 2007-10-18 06:20:07 UTC (rev 73) @@ -1,41 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - */ - -package gridsim.gui; - -/** - * This interface has to be implemented by classes with which the - * allocation listeners can register. An {@link AllocationSubject} provides - * information to listeners. This is mainly used by the visualisation tool - * to display information about the scheduling queues. - * - * @author Marcos Dias de Assuncao - * @since GridSim Turbo Alpha 0.1 - * - * @see AllocationAction - * @see AllocationListener - */ - -public interface AllocationSubject { - - /** - * Registers an {@link AllocationListener}. - * @param listener the allocation listener - * @return <tt>true</tt> if it has been registered or - * <tt>false</tt> otherwise - */ - boolean addAllocationListener(AllocationListener listener); - - /** - * Unregisters an {@link AllocationListener}. - * @param listener the listener to be removed - * @return <tt>true</tt> if the listener has been removed - * or <tt>false</tt> otherwise - */ - boolean removeAllocationListener(AllocationListener listener); - -} Modified: branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-18 06:20:07 UTC (rev 73) @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; @@ -92,14 +93,21 @@ // a table containing references to the resource windows. That is, // each resource has a window that displays the content of the // scheduling queue and the allocation actions performed - private HashMap<String,ResourceWindow> resourceWindows_ = null; + private HashMap<String, ResourceWindow> resourceWindows_ = null; private ArrayList<GridResource> resources_ = null; + // a list of all the allocation listeners in the system + private static LinkedHashMap<Integer, AllocationListener> listeners_; + // constants to indicate the time unit to be used for displaying // information public static final int TIME_UNIT_SECOND = 0; public static final int TIME_UNIT_MINUTE = 1; public static final int TIME_UNIT_HOUR = 2; + + static { + listeners_ = new LinkedHashMap<Integer, AllocationListener>(); + } /** * Creates the main window of the visualiser. @@ -192,6 +200,65 @@ } // ------------------------- PUBLIC METHODS ------------------------- + + /** + * Notifies a listener about the action performed + * @param action the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listener. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @see AllocationAction#ITEM_ARRIVED + * @see AllocationAction#ITEM_SCHEDULED + * @see AllocationAction#ITEM_CANCELLED + * @see AllocationAction#ITEM_COMPLETED + * @see AllocationAction#ITEM_STATUS_CHANGED + * @see AllocationAction#SCHEDULE_CHANGED + */ + public static void notifyListeners(AllocationAction action, boolean shouldPause) { + AllocationListener listener = listeners_.get(action.getSubject()); + if(listener != null) { + listener.allocationActionPerformed(action); + informListenersAboutTime(); + + if(shouldPause){ + if(GridSim.isStepByStepEnabled()){ + GridSim.pauseSimulation(); + } + else if(GridSim.isSlowMotionModeEnabled()){ + GridSim.smallPause(); + } + } + } + } + + /** + * Adds a listener to the list of listeners interested in the events + * generated by a given entity + * @param entityId the id of the entity in which the listener is interested + * @param listener the listener to be registered + * @return <tt>true</tt> if success or <tt>false</tt> otherwise + */ + public static boolean addAllocationListener(int entityId, + AllocationListener listener) { + if(listeners_.containsKey(entityId)) + return false; + + listeners_.put(entityId, listener); + return true; + } + + /** + * Unregisters a listener from the list of listeners + * @param listener the listener to be unregistered + * @return <tt>true</tt> if success or <tt>false</tt> otherwise + */ + public static boolean removeAllocationListener(AllocationListener listener) { + if(!listeners_.containsValue(listener)){ + return false; + } + listeners_.remove(listener); + return true; + } /** * Handles events triggered by the list of resource @@ -208,23 +275,23 @@ String cmd = e.getActionCommand(); if(cmd.equals("Step")){ - GridSim.STEP_BY_STEP_SIMULATION = true; - GridSim.SLOW_MOTION_SIMULATION = false; + GridSim.enableStepByStepMode(); + GridSim.disableSlowMotionMode(); checkFirstClick(); GridSim.resumeSimulation(); } else if(cmd.equals("Run")){ - GridSim.STEP_BY_STEP_SIMULATION = false; - GridSim.SLOW_MOTION_SIMULATION = false; + GridSim.disableStepByStepMode(); + GridSim.disableSlowMotionMode(); if(!checkFirstClick()) { GridSim.resumeSimulation(); } } else if(cmd.equals("Slow Motion")){ - GridSim.STEP_BY_STEP_SIMULATION = false; - GridSim.SLOW_MOTION_SIMULATION = true; + GridSim.disableStepByStepMode(); + GridSim.enableSlowMotionMode(); if(!checkFirstClick()) { GridSim.resumeSimulation(); @@ -241,11 +308,25 @@ } // ------------------------- PRIVATE METHODS ------------------------- + + /** + * Informs all the listeners about the change in the + * simulation time + */ + private static void informListenersAboutTime() { + Iterator<AllocationListener> iterListener = listeners_.values().iterator(); + while(iterListener.hasNext()) { + AllocationListener listener = iterListener.next(); + AllocationAction action = + new AllocationAction(AllocationAction.SIMULATION_TIME_CHANGED); + listener.allocationActionPerformed(action); + } + } /** * This method initialises the resource windows */ - private void initResourceWindows(){ + private void initResourceWindows() { int windowId = 0; for(GridResource resource : resources_){ GridResource tresource = (GridResource)resource; @@ -256,7 +337,7 @@ // of the allocation policy. This means that the window will be // notified of the allocation actions performed by the resource // allocation policy - tresource.getAllocationPolicy().addAllocationListener(window); + listeners_.put(tresource.getAllocationPolicy().get_id(), window); windowId++; } } @@ -264,7 +345,7 @@ /** * Creates the menu bar of the main window */ - private void createMenuBar(){ + private void createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu menuCommand = new JMenu("Start"); JMenuItem item; Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-18 06:20:07 UTC (rev 73) @@ -20,6 +20,7 @@ package gridsim.gui; import gridsim.GridResource; +import gridsim.GridSim; import gridsim.Gridlet; import gridsim.turbo.PERange; import gridsim.turbo.PERangeList; @@ -185,42 +186,45 @@ public boolean allocationActionPerformed(AllocationAction action) { int type = action.getActionType(); LinkedList<ScheduleItem> list = action.getScheduleItems(); - currentTime_ = (long) action.getTime(); + currentTime_ = (long) GridSim.clock(); switch(type){ - case AllocationAction.GRIDLET_ARRIVED: - case AllocationAction.RESERVATION_STARTED: - case AllocationAction.RESERVATION_COMMITED: - case AllocationAction.RESERVATION_FINISHED: - case AllocationAction.RESERVATION_ARRIVED: + case AllocationAction.ITEM_ARRIVED: + case AllocationAction.ITEM_STATUS_CHANGED: for(ScheduleItem item : list){ itemPanel_.updateItem(item); } + updateResourceWindow(); break; - case AllocationAction.GRIDLET_SCHEDULED: - case AllocationAction.RESERVATION_SCHEDULED: + case AllocationAction.ITEM_SCHEDULED: for(ScheduleItem item : list){ scheduledItems_.add(item); - updateTimeSpan(item); + double finishTime = item.getFinishTime(); + updateTimeSpan(finishTime); itemPanel_.updateItem(item); } + updateResourceWindow(); break; - case AllocationAction.RESERVATION_CANCELLED: - case AllocationAction.GRIDLET_CANCELLED: + case AllocationAction.ITEM_CANCELLED: for(ScheduleItem item : list){ itemPanel_.updateItem(item); scheduledItems_.remove(item); } + updateResourceWindow(); break; + + case AllocationAction.SIMULATION_TIME_CHANGED: + if(updateTimeSpan(currentTime_)) + updateResourceWindow(); + break; - case AllocationAction.GRIDLET_COMPLETED: + case AllocationAction.ITEM_COMPLETED: case AllocationAction.SCHEDULE_CHANGED: + updateResourceWindow(); break; } - - updateResourceWindow(); return true; } @@ -375,9 +379,14 @@ /** * Updates the time span, that is, the time frame shown in the window */ - private void updateTimeSpan(ScheduleItem item){ - double finishTime = item.getFinishTime(); - timeSpan_ = (finishTime > timeSpan_) ? finishTime : timeSpan_; + private boolean updateTimeSpan(double time) { + if(time > timeSpan_) { + timeSpan_ = time; + return true; + } + else { + return false; + } } /** Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-18 06:20:07 UTC (rev 73) @@ -163,10 +163,6 @@ // last time the expiration of reservations was checked private double lastCheckExpiryTime_; - // FOR DEBUGGING PURPOSES ONLY - // Keep the time of the last allocation action - private double lastActionTime_; - /** * Creates a new scheduler that handles advanced reservations. This * scheduler uses First Come First Served (FCFS) algorithm with @@ -295,10 +291,6 @@ public void handleCreateReservation(ARMessage message) { double currentTime = GridSim.clock(); - // stores the last action time for debugging purposes - // and for the graphical user interface - lastActionTime_ = currentTime; - // gets the reservation object and extract some // information from it Reservation reservation = message.getReservation(); @@ -316,8 +308,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- // informs the listeners that a reservation request has arrived - super.notifyListeners(AllocationAction.RESERVATION_ARRIVED, - true, lastActionTime_, sRes); + super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sRes); //---------------------------------------------------------- @@ -464,8 +455,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- // Informs the listeners about the reservation that has been created - super.notifyListeners(AllocationAction.RESERVATION_SCHEDULED, - true, lastActionTime_, sRes); + super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sRes); //---------------------------------------------------------- } @@ -479,9 +469,6 @@ public void handleCancelReservation(ARMessage message) { double currentTime = GridSim.clock(); - // stores the last action time for debugging purposes - lastActionTime_ = currentTime; - // gets the reservation id of the message int reservationId = message.getReservationID(); boolean success = true; @@ -535,8 +522,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.RESERVATION_CANCELLED, - true, lastActionTime_, sRes); + super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, sRes); //---------------------------------------------------------------------- @@ -546,8 +532,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // Inform the listeners about the new schedule - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, - true, lastActionTime_); + super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); //---------------------------------------------------------------------- @@ -563,9 +548,6 @@ double currentTime = GridSim.clock(); - // stores the last action time for debugging purposes - lastActionTime_ = currentTime; - // gets the reservation id of the message int reservationId = message.getReservationID(); SSReservation sRes = null; @@ -629,8 +611,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- - super.notifyListeners(AllocationAction.RESERVATION_COMMITED, - true, lastActionTime_, sRes); + super.notifyListeners(AllocationAction.ITEM_STATUS_CHANGED, true, sRes); //---------------------------------------------------------- } @@ -650,12 +631,7 @@ * @param message the advance reservation message received. */ public void handleQueryFreeTime(ARMessage message) { - - double currentTime = GridSim.clock(); - // stores the last action time for debugging purposes - lastActionTime_ = currentTime; - // gets the reservation id of the message Reservation reservation = message.getReservation(); @@ -681,11 +657,7 @@ * @param message the advance reservation message received. */ public void handleQueryReservation(ARMessage message) { - double currentTime = GridSim.clock(); - - // stores the last action time for debugging purposes - lastActionTime_ = currentTime; - + // gets the reservation id of the message int reservationId = message.getReservationID(); @@ -800,8 +772,6 @@ public void gridletCancel(int gridletId, int userId) { double currentTime = GridSim.clock(); - // set the time of the last allocation action - lastActionTime_ = currentTime; // stores the gridlet if found SSGridlet sgl = null; boolean found = false; @@ -859,8 +829,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.GRIDLET_CANCELLED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, sgl); //---------------------------------------------------------------------- @@ -873,8 +842,7 @@ //------------------- USED FOR DEBUGGING PURPOSES ONLY ----------------- // Inform the listeners about the new schedule - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, - true, lastActionTime_); + super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); //---------------------------------------------------------------------- @@ -999,7 +967,6 @@ reservTable_ = new LinkedHashMap<Integer, SSReservation>(); expiryTable_ = new LinkedHashMap<Integer, SSReservation>(); orderStartTime_ = new OrderGridletByStartTime(); - lastActionTime_ = -1; lastScheduleUpdate_ = -1; lastReservationStart_ = -1; lastCheckExpiryTime_ = -1; @@ -1016,8 +983,6 @@ */ private void handleNonReservationGridlet(Gridlet gridlet, boolean ack) { int reqPE = gridlet.getNumPE(); - double currentTime = GridSim.clock(); - lastActionTime_ = currentTime; try{ // reject the Gridlet if it requires more PEs than the resource @@ -1044,8 +1009,7 @@ //------------------ FOR DEBUGGING PURPOSES ONLY------------------------ - super.notifyListeners(AllocationAction.GRIDLET_ARRIVED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sgl); //---------------------------------------------------------------------- @@ -1070,8 +1034,7 @@ // Notifies the listeners that a Gridlet has been either scheduled // to run immediately or put in the waiting queue - super.notifyListeners(AllocationAction.GRIDLET_SCHEDULED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sgl); //--------------------------------------------------------------- @@ -1095,10 +1058,6 @@ double currentTime = GridSim.clock(); - // stores the last action time for debugging purposes - lastActionTime_ = currentTime; - - int freePE; int reqPE = gridlet.getNumPE(); // gets the advance reservation @@ -1113,8 +1072,7 @@ /////////////// FOR DEBUGGING PURPOSES ONLY //////// - super.notifyListeners(AllocationAction.GRIDLET_ARRIVED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sgl); ///////////////////////////////////////////////////// @@ -1194,8 +1152,7 @@ // Notifies the listeners that a Gridlet has been either scheduled // to run immediately or put in the waiting queue - super.notifyListeners(AllocationAction.GRIDLET_SCHEDULED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sgl); //--------------------------------------------------------------- @@ -1227,8 +1184,6 @@ double currentTime = GridSim.clock() ; // the Gridlet's expected finish time double finishTime = currentTime + executionTime; - // keep the time of the last allocation action - lastActionTime_ = currentTime; // check whether there are PEs available over the time interval requested Object[] availObj = @@ -1272,8 +1227,6 @@ // calculate the execution time of the Gridlet double executionTime = super.forecastExecutionTime(ratingPE_, sgl.getRemainingLength()); - // keep the time of the last allocation action - lastActionTime_ = GridSim.clock(); double startTime = -1; // keep the potential start time of the gridlet double finishTime = -1; // store the gridlet's expected finish time @@ -1361,8 +1314,8 @@ //---------------- USED FOR DEBUGGING PURPOSES ONLY ---------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.GRIDLET_CANCELLED, - false, lastActionTime_, removedGridlets); + super.notifyListeners(AllocationAction.ITEM_CANCELLED, + false, removedGridlets); //------------------------------------------------------------------ } @@ -1529,7 +1482,6 @@ private void checkExpiryTime() { double currentTime = GridSim.clock(); // get current time - lastActionTime_ = currentTime; // gridlets whose start time is larger than reference time // will be shifted forwards when the compression of the @@ -1568,8 +1520,7 @@ //-------------- USED FOR DEBUGGING PURPOSES ONLY ----------------- // If a gridlet has been cancelled, then inform the listeners - super.notifyListeners(AllocationAction.RESERVATION_CANCELLED, - true, lastActionTime_, removedRes); + super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, removedRes); //----------------------------------------------------------------- @@ -1586,8 +1537,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, - true, lastActionTime_); + super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); //----------------------------------------------------------------- } @@ -1602,7 +1552,6 @@ private void updateSchedule(){ double currentTime = GridSim.clock(); - lastActionTime_ = currentTime; int gridletFinished = 0; int gridletStarted = 0; boolean reserved; @@ -1648,8 +1597,8 @@ // If a gridlet has started execution or one has finished, // then inform the listeners if(gridletStarted > 0 || gridletFinished > 0){ - super.notifyListeners(AllocationAction.GRIDLET_COMPLETED, - true, lastActionTime_, grlsCompleted); + super.notifyListeners(AllocationAction.ITEM_COMPLETED, + true, grlsCompleted); } } @@ -1660,7 +1609,6 @@ private void startReservation() { double currentTime = GridSim.clock(); - lastActionTime_ = currentTime; LinkedList<SSReservation> startedReservations = new LinkedList<SSReservation>(); PERangeList allocatedRanges = new PERangeList(); int numStartedRes = 0; @@ -1700,8 +1648,8 @@ //------------- USED FOR DEBUGGING PURPOSES ONLY ------------------ // notify the listeners - super.notifyListeners(AllocationAction.RESERVATION_STARTED, - true, lastActionTime_, startedReservations); + super.notifyListeners(AllocationAction.ITEM_STATUS_CHANGED, + true, startedReservations); //------------------------------------------------------------------ @@ -1711,8 +1659,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, - true, lastActionTime_); + super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); //------------------------------------------------------------------ } @@ -1726,7 +1673,6 @@ private void finishReservation() { double currentTime = GridSim.clock(); - lastActionTime_ = currentTime; int reservationFinished = 0; // remove all reservations that have already completed @@ -1760,8 +1706,7 @@ // If a gridlet has started execution or one has finished, // then inform the listeners - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, - true, lastActionTime_); + super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); //----------------------------------------------------------------- } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java 2007-10-18 06:20:07 UTC (rev 73) @@ -76,6 +76,9 @@ "a policy that supports advance reservation"); } initARPolicy(); + + // sets the name of this thread for debugging purposes. + super.setName(super.get_name()); } /** @@ -115,6 +118,9 @@ "a policy that supports advance reservation"); } initARPolicy(); + + // sets the name of this thread for debugging purposes. + super.setName(super.get_name()); } /////////////////////// PROTECTED METHOD ///////////////////////////////// Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-18 06:20:07 UTC (rev 73) @@ -116,10 +116,6 @@ // to order gridlets by potential start time private OrderGridletByStartTime orderStartTime_; - // FOR DEBUGGING PURPOSES ONLY - // Keep the time of the last allocation action - private double lastActionTime_; - // the last time when the schedule updated was called private double lastScheduleUpdate_; @@ -151,7 +147,6 @@ queuedGridlets_ = new LinkedList<SSGridlet>(); availProfile_ = new AvailabilityProfile(); orderStartTime_ = new OrderGridletByStartTime(); - lastActionTime_ = 0.0D; lastScheduleUpdate_ = 0.0D; ratingPE_ = 0; } @@ -213,8 +208,6 @@ */ public void gridletSubmit(Gridlet gridlet, boolean ack) { int reqPE = gridlet.getNumPE(); - double currentTime = GridSim.clock(); - lastActionTime_ = currentTime; try{ // reject the Gridlet if it requires more PEs than the resource @@ -241,8 +234,7 @@ //-------------- FOR DEBUGGING PURPOSES ONLY -------------- - super.notifyListeners(AllocationAction.GRIDLET_ARRIVED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_ARRIVED, true, sgl); //---------------------------------------------------------- @@ -267,8 +259,7 @@ // Notifies the listeners that a Gridlet has been either scheduled // to run immediately or put in the waiting queue - super.notifyListeners(AllocationAction.GRIDLET_SCHEDULED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_SCHEDULED, true, sgl); //--------------------------------------------------------------- @@ -354,8 +345,6 @@ public void gridletCancel(int gridletId, int userId) { double currentTime = GridSim.clock(); - // set the time of the last allocation action - lastActionTime_ = currentTime; // stores the gridlet if found SSGridlet sgl = null; boolean found = false; @@ -408,8 +397,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // If a gridlet has been cancelled, then inform the listeners about it - super.notifyListeners(AllocationAction.GRIDLET_CANCELLED, - true, lastActionTime_, sgl); + super.notifyListeners(AllocationAction.ITEM_CANCELLED, true, sgl); //---------------------------------------------------------------------- @@ -419,8 +407,7 @@ //----------------- USED FOR DEBUGGING PURPOSES ONLY ------------------- // Inform the listeners about the new schedule - super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, - true, lastActionTime_); + super.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true); //---------------------------------------------------------------------- @@ -496,8 +483,6 @@ double currentTime = GridSim.clock() ; // the Gridlet's expected finish time double finishTime = currentTime + executionTime; - // keep the time of the last allocation action - lastActionTime_ = currentTime; // check whether there are PEs available over the time interval requested Object[] availObj = @@ -541,8 +526,6 @@ // calculate the execution time of the Gridlet double executionTime = super.forecastExecutionTime(ratingPE_, sgl.getRemainingLength()); - // keep the time of the last allocation action - lastActionTime_ = GridSim.clock(); double startTime = -1; // keep the potential start time of the gridlet double finishTime = -1; // store the gridlet's expected finish time @@ -909,7 +892,6 @@ private void updateSchedule(){ double currentTime = GridSim.clock(); - lastActionTime_ = currentTime; int gridletFinished = 0; int gridletStarted = 0; @@ -977,8 +959,8 @@ // If a gridlet has started execution or one has finished, // then inform the listeners if(gridletStarted > 0 || gridletFinished > 0){ - super.notifyListeners(AllocationAction.GRIDLET_COMPLETED, - true, lastActionTime_, grlsCompleted); + super.notifyListeners(AllocationAction.ITEM_COMPLETED, + true, grlsCompleted); } //---------------------------------------------------------------------- } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-18 06:20:07 UTC (rev 73) @@ -496,6 +496,9 @@ */ private void init() { reservations_ = new HashMap<Integer,Reservation>(); + + // sets the name of this thread for debugging purposes. + super.setName(super.get_name()); } /** Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-18 01:28:20 UTC (rev 72) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-18 06:20:07 UTC (rev 73) @@ -61,6 +61,9 @@ protected TAllocPolicy(String resourceName, String entityName) throws Exception{ super(resourceName, entityName); + + // sets the name of this thread for debugging purposes. + super.setName(super.get_name()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2007-10-18 01:28:20
|
Revision: 72 http://gridsim.svn.sourceforge.net/gridsim/?rev=72&view=rev Author: sulistio Date: 2007-10-17 18:28:20 -0700 (Wed, 17 Oct 2007) Log Message: ----------- Fix a bug #1807701 as suggested by Stanislaw Szczepanowski. Modified Paths: -------------- trunk/source/gridsim/Accumulator.java Modified: trunk/source/gridsim/Accumulator.java =================================================================== --- trunk/source/gridsim/Accumulator.java 2007-10-17 01:14:31 UTC (rev 71) +++ trunk/source/gridsim/Accumulator.java 2007-10-18 01:28:20 UTC (rev 72) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * - * $Id: Accumulator.java,v 1.13 2004/11/01 02:52:33 anthony Exp $ + * $Id: Accumulator.java,v 1.14 2007/10/18 01:26:48 anthony Exp $ */ package gridsim; @@ -132,10 +132,20 @@ * @post $none */ public double getStandardDeviation() { - return sqrMean_ - (mean_ * mean_); + return Math.sqrt( this.getVariance() ); } /** + * Calculates the variance of accumulated items + * @return the Standard Deviation of accumulated items + * @pre $none + * @post $none + */ + public double getVariance() { + return sqrMean_ - (mean_ * mean_); + } + + /** * Finds the smallest number of accumulated items * @deprecated As of GridSim 2.1, replaced by {@link #getMin()} * @return the smallest of accumulated items This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-17 01:14:29
|
Revision: 71 http://gridsim.svn.sourceforge.net/gridsim/?rev=71&view=rev Author: marcos_dias Date: 2007-10-16 18:14:31 -0700 (Tue, 16 Oct 2007) Log Message: ----------- This update is only to clear the lists and tables created by the allocation policies. I want to implement restart of a simulation and this will be required. Modified Paths: -------------- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java Modified: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-10-16 07:12:49 UTC (rev 70) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-10-17 01:14:31 UTC (rev 71) @@ -85,10 +85,10 @@ ////////////////////////////////////////// // Starts the simulation in debug mode -// GridSim.startGridSimulation(true); + GridSim.startGridSimulation(true); // Start the simulation in normal mode - GridSim.startGridSimulation(); +// GridSim.startGridSimulation(); ////////////////////////////////////////// // Final step: Prints the Gridlets when simulation is over Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-16 07:12:49 UTC (rev 70) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-17 01:14:31 UTC (rev 71) @@ -276,6 +276,13 @@ System.out.println(super.get_name() + ".body(): ignore internal events"); } + + queuedGridlets_.clear(); + runningGridlets_.clear(); + orderStartTime_ = null; + reservTable_.clear(); + expiryTable_.clear(); + availProfile_.clear(); } //---------------- RESERVATION RELATED PUBLIC METHODS --------------------- Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-16 07:12:49 UTC (rev 70) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-17 01:14:31 UTC (rev 71) @@ -196,6 +196,11 @@ super.sim_get_next(ev); System.out.println(super.get_name() + ".body(): ignore internal events"); } + + queuedGridlets_.clear(); + runningGridlets_.clear(); + orderStartTime_ = null; + availProfile_.clear(); } /** Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-16 07:12:49 UTC (rev 70) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-17 01:14:31 UTC (rev 71) @@ -13,7 +13,6 @@ import gridsim.GridSimTags; import gridsim.net.Link; -import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-16 07:12:49 UTC (rev 70) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-17 01:14:31 UTC (rev 71) @@ -23,7 +23,7 @@ * @since GridSim Turbo Alpha 0.1 */ -public class SSReservation implements ScheduleItem{ +public class SSReservation implements ScheduleItem { // the Reservation that this SSReservation represents private Reservation reservation_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-16 07:12:50
|
Revision: 70 http://gridsim.svn.sourceforge.net/gridsim/?rev=70&view=rev Author: marcos_dias Date: 2007-10-16 00:12:49 -0700 (Tue, 16 Oct 2007) Log Message: ----------- This update contains: + Support for querying the availability of processing elements (PEs) at a Grid resource able to handle advance reservations. Modified Paths: -------------- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java branches/gridsim4.0-branch3/source/gridsim/turbo/PERangeList.java branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java Added Paths: ----------- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java Modified: branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-10-16 07:12:49 UTC (rev 70) @@ -13,6 +13,7 @@ import gridsim.GridletList; import gridsim.turbo.Reservation; import gridsim.turbo.ReservationRequester; +import gridsim.turbo.TimeSlotList; import java.util.ArrayList; import java.util.Calendar; @@ -177,7 +178,15 @@ val = randObj.nextInt(totalResource); resID = ( (Integer) resARList.get(val) ).intValue(); resName = (String) resNameList.get(val); - + + // queries the availability of the Grid resource + TimeSlotList availability = + super.queryFreeTime(GridSim.clock(), Integer.MAX_VALUE, resID); + + System.out.println("Availability information returned by the " + + "Grid resource # " + resID + " at time # " + GridSim.clock() + + " is as follows: \n " + availability); + // try immediate reservation, where starting time is 0 meaning // use current time as the start time if (val == i) { @@ -186,6 +195,10 @@ else { time = 1 * HOUR + duration; } + + double potStartTime = availability.getPotentialStartTime(duration, totalPE); + System.out.println("The reservation requiring " + totalPE + " PEs could " + + "be served by Grid resource # " + resID + " at time # " + potStartTime); // creates a new reservation Reservation reservation = null; @@ -206,6 +219,12 @@ // commit the reservation if(success) { + + // query the status of the reservation + int status = super.queryReservation(reservation.getID()); + System.out.println("The status of reservation # " + reservation.getID() + + " is # " + Reservation.getStatusString(status)); + // for a reservation with an even number, commits straightaway // without sending any Gridlets yet success = super.commitReservation(reservation.getID()); @@ -218,6 +237,11 @@ System.out.println("Reservation # "+ reservation.getID() + " has NOT been committed successfully."); } + + // query the status of the reservation again + status = super.queryReservation(reservation.getID()); + System.out.println("The status of reservation # " + reservation.getID() + + " is # " + Reservation.getStatusString(status)); } if(success && i<list_.size()) { Modified: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-10-16 07:12:49 UTC (rev 70) @@ -85,10 +85,10 @@ ////////////////////////////////////////// // Starts the simulation in debug mode - GridSim.startGridSimulation(true); +// GridSim.startGridSimulation(true); // Start the simulation in normal mode -// GridSim.startGridSimulation(); + GridSim.startGridSimulation(); ////////////////////////////////////////// // Final step: Prints the Gridlets when simulation is over Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-16 07:12:49 UTC (rev 70) @@ -27,8 +27,16 @@ private int msgType_; // the type of this message private int errorCode_; // an error code associated with the operation required private Reservation reservation_; // the negotiation this message is about - private double price_; // the price associate with this message + + // If a Grid resource cannot make a reservation, it may provide options + // by informing the reservation requester when resource will be available to + // fulfil the reservation. This attribute contains the list of PEs + // available at a set of simulation times + private TimeSlotList resOptions_; + // the price associate with this message + private double price_; + // starting constant value for the tags to avoid conflicts // with the GridSim tags and other tags private static final int BASE = 5000; @@ -105,6 +113,7 @@ msgType_ = TYPE_UNKNOWN; errorCode_ = EC_NO_ERROR; reservation_ = null; + resOptions_ = null; } /** @@ -152,6 +161,7 @@ msgId_ = ARMessage.createUniqueID(); reservation_ = reservation; errorCode_ = EC_NO_ERROR; + resOptions_ = null; } /** @@ -367,6 +377,22 @@ public double getPrice() { return price_; } + + /** + * Gets the reservation options given by the Grid resource + * @return the reservation options + */ + public TimeSlotList getReservationOptions() { + return resOptions_; + } + + /** + * Sets the reservation options given by the Grid resource + * @param resOptions the reservation options object + */ + public void setReservationOptions(TimeSlotList resOptions) { + resOptions_ = resOptions; + } /** * Returns the size in bytes for this message. @@ -391,7 +417,6 @@ ARMessage newMessage = new ARMessage(dstId_, srcId_, reservation_); newMessage.msgType_ = msgType_; newMessage.price_ = price_; - newMessage.reservation_ = reservation_; return newMessage; } catch (Exception ex) { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-16 07:12:49 UTC (rev 70) @@ -83,7 +83,7 @@ * <li> cancel a reservation * <li> commit a reservation * <li> process a reservation status query - * <li> list free time over a certain period of time (under development) + * <li> list free time over a certain period of time * </ul> * <p> * <b>LIMITATIONS:</b><br> @@ -639,12 +639,34 @@ } /** - * Handles a query free time request (NOTE: <b>NOT YET SUPPORTED</b>). + * Handles a query free time request. * @param message the advance reservation message received. */ public void handleQueryFreeTime(ARMessage message) { - System.out.println(super.get_name() + - ".handleQueryFreeTime(): not supported at the moment."); + + double currentTime = GridSim.clock(); + + // stores the last action time for debugging purposes + lastActionTime_ = currentTime; + + // gets the reservation id of the message + Reservation reservation = message.getReservation(); + + // creates a response message to be sent to the requester + ARMessage response = message.createResponse(); + + // gets the start time and finish time the user is interested in + double startTime = reservation.getStartTime(); + int duration = reservation.getDurationTime(); + + // gets the availability information from the availability profile + TimeSlotList availability = getAvailabilityInfo(startTime, duration); + + // sets the options as the availability over the requested period + response.setReservationOptions(availability); + + // Sends the response back to the user + super.sendARMessage(response); } /** @@ -2313,4 +2335,96 @@ availProfile_.add(tailInsertPos, newEntryAfterTail); } } + + /** + * This method returns a list that corresponds to the free time slots + * in the scheduling queue managed by this scheduler or + * resource allocation policy. + * @param startTime the start time in which the requester is interested. + * @param finishTime the finish time in which the requester is interested. + * @return the list of free time slots. The list is actually a list of + * entries that correspond to the availability profile between the times + * specified by the requester. + */ + private TimeSlotList getAvailabilityInfo(double startTime, int duration) { + + TimeSlotList list = new TimeSlotList(); + int anchorIndex = -1; + + // if the user specified the start time as 0, it means that the + // user is interested to know the availability starting from the + // current time, or the time when the resource received this request + if(startTime == 0) { + startTime = GridSim.clock(); + } + + list.setStartTime(startTime); + + // calculate the reservation's finish time + double finishTime = startTime + duration; + list.setFinishTime(finishTime); + + // a pointer to the anchor entry (described above) + AvailabilityProfileEntry anchorEntry = null; + int length = availProfile_.size(); + TimeSlotEntry firstEntry = null; + + double entryTime; + + Iterator<AvailabilityProfileEntry> iterProfile = + availProfile_.iterator(); + while(iterProfile.hasNext()) { + AvailabilityProfileEntry entry = iterProfile.next(); + entryTime = entry.getTime(); + if(entryTime > startTime) { + break; + } + else { + anchorEntry = entry; + } + } + + // if the entry is null, then it means that the reservation is + // before the first entry of the profile, so the intersection list + // has to start with the ranges of PEs currently available + if (anchorEntry == null) { + firstEntry = + new TimeSlotEntry(startTime, resource_.getFreePERanges().clone()); + } + else { + PERangeList newList = anchorEntry.getPERanges(); + if(newList != null) { + newList = newList.clone(); + } + firstEntry = new TimeSlotEntry(startTime, newList); + anchorIndex = availProfile_.indexOf(anchorEntry); + } + + list.add(firstEntry); + + // Iterates the availability profile and adds all the entries + // whose times are between start and finish time in the list + // to be returned. It removes duplicated entries + AvailabilityProfileEntry previousEntry = null; + for(int i=anchorIndex+1; i<length; i++) { + AvailabilityProfileEntry nextEntry = availProfile_.get(i); + if(nextEntry.getTime() > finishTime){ + break; + } + else { + if( !(previousEntry != null && previousEntry.hasSamePERanges(nextEntry)) ) { + PERangeList peList = nextEntry.getPERanges(); + if(peList != null) { + peList = peList.clone(); + } + TimeSlotEntry tsEntry = + new TimeSlotEntry(nextEntry.getTime(), peList.clone()); + list.add(tsEntry); + } + previousEntry = nextEntry; + } + } + + return list; + } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java 2007-10-16 07:12:49 UTC (rev 70) @@ -25,7 +25,7 @@ /** * Creates a new @link{AvailabilityProfile} object. */ - public AvailabilityProfile(){ + public AvailabilityProfile() { super(); } @@ -34,7 +34,7 @@ * <b>NOTE:</b> this method does not clone the entries * @return the cloned object */ - public AvailabilityProfile clone(){ + public AvailabilityProfile clone() { AvailabilityProfile clone = new AvailabilityProfile(); for(AvailabilityProfileEntry entry : this){ clone.add(entry); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2007-10-16 07:12:49 UTC (rev 70) @@ -106,6 +106,23 @@ } /** + * Returns <tt>true</tt> if this entry has the same list of ranges of PEs + * as the entry provided. + * @param entry the entry whose ranges have to be compared + * @return <tt>true</tt> if the ranges are the same or false otherwise. + */ + public boolean hasSamePERanges(AvailabilityProfileEntry entry) { + boolean result = false; + if(ranges_ == null && entry.ranges_ == null) { + result = true; + } + else if(ranges_ != null) { + result = ranges_.equals(entry.ranges_); + } + return result; + } + + /** * Creates a string representation of this entry */ public String toString(){ Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/PERangeList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/PERangeList.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/PERangeList.java 2007-10-16 07:12:49 UTC (rev 70) @@ -128,6 +128,11 @@ * @return <tt>true</tt> if they are equals or <tt>false</tt> otherwise. */ public boolean equals(PERangeList list) { + + if(list == null) { + return false; + } + if(super.size() != list.size()) { return false; } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2007-10-16 07:12:49 UTC (rev 70) @@ -10,9 +10,6 @@ package gridsim.turbo; import gridsim.GridSim; -import gridsim.gui.GridSimVisualizer; - -import java.text.DecimalFormat; import java.util.Calendar; /** Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-14 23:06:27 UTC (rev 69) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-16 07:12:49 UTC (rev 70) @@ -105,7 +105,7 @@ int numPE, int resID) { // check all the values first - boolean success = validateValue(startTime, duration, numPE, resID); + boolean success = validateValue(startTime, duration, numPE); if (!success) { return null; } @@ -187,7 +187,7 @@ int resId = currReservation.getResourceID(); // check all the values first - boolean success = validateValue(startTime, duration, numPE, resId); + boolean success = validateValue(startTime, duration, numPE); if (!success) { return null; } @@ -297,26 +297,84 @@ } /** - * Querys to a resource regarding to list of free time during a period of - * time. Each object inside ArrayList is <tt>long array[3]</tt>, with: + * Queries to a resource regarding to list of free time during a period of + * time. This method returns a list that contains the availability + * of PEs at simulation times between the start and end time. Each entry + * contains: * <ul> - * <li> array[0] = start time - * <li> array[1] = duration time - * <li> array[2] = number of PEs + * <li> time of the entry + * <li> list of ranges of PEs available at that particular time * </ul> * - * @param resourceID a resource ID - * @param from starting time in milliseconds - * @param to ending time in milliseconds - * @return ArrayList object or <tt>null</tt> if error occurs + * @param resID a resource ID + * @param startTime the simulation start time in which + * the requester is interested + * @param duration duration time in seconds + * @return a list of entries that describe the ranges of PEs + * available at simulation time between the requested time * @pre resourceID > 0 - * @pre from > 0 - * @pre to > 0 - * @post $none + * @pre startTime >= 0 + * @pre finishTime > 0 */ - public ArrayList queryFreeTime(int resourceID, long from, long to) { - // TODO: To find a nice way to do it. - return null; + public TimeSlotList queryFreeTime(double startTime, + int duration, int resID) { + + // check all the values first + boolean success = validateValue(startTime, duration, 1); + if (!success) { + return null; + } + + TimeSlotList resOptions = null; + try { + + // create the reservation itself + Reservation reservation = new Reservation(super.get_id()); + reservation.setStartTime(startTime); + reservation.setDurationTime(duration); + reservation.setResourceID(resID); + + // creates the message to be sent to the grid resource + ARMessage message = new ARMessage(super.get_id(), resID, reservation); + message.setMessageType(ARMessage.TYPE_AR_LIST_FREE_TIME); + + // sends the message to the grid resource + sendARMessage(message); + + // wait for feedback whether the reservation has been accepted or not + FilterARMessage tagObj = + new FilterARMessage(reservation.getID(), + ARMessage.TYPE_AR_LIST_FREE_TIME); + + // only look for this type of ack for same reservation ID + Sim_event ev = new Sim_event(); + super.sim_get_next(tagObj, ev); + + // gets the reply from the grid resource + ARMessage reply = (ARMessage)ev.get_data(); + + // gets the error code. If the error code is EC_NO_ERROR + // it means that the reservation has been successful. + // Otherwise, print the error message + int error = reply.getErrorCode(); + if(error == ARMessage.EC_NO_ERROR) { + resOptions = reply.getReservationOptions(); + } + else { + System.out.println(super.get_name() + ": Resource # " + resID + + " could not inform the availability at time " + GridSim.clock()); + resOptions = null; + } + } + + catch (Exception ex) { + System.out.println(super.get_name() + ": Resource # " + resID + + " could not inform the availability at time " + GridSim.clock()); + ex.printStackTrace(); + resOptions = null; + } + + return resOptions; } /** @@ -450,8 +508,7 @@ * @param resID a resource ID * @return <tt>true</tt> if they are valid or <tt>false</tt> otherwise. */ - private boolean validateValue(double startTime, - int duration, int numPE, int resID) { + private boolean validateValue(double startTime, int duration, int numPE) { // current time = simulation time double currentTime = GridSim.clock(); Added: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-10-16 07:12:49 UTC (rev 70) @@ -0,0 +1,129 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package gridsim.turbo; + +/** + * The {@link TimeSlotEntry} class represents an entry in a list of + * time slots available, which can be allocated to a user. This is used + * in return to a query for free time slots in an advance reservation + * based allocation policy. + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see ARTPolicy + * @see PERange + * @see PERangeList + * @see TimeSlotList + * @see ARParallelSpaceShared + * @see ARParallelSpaceShared#handleQueryFreeTime(ARMessage) + */ + +public class TimeSlotEntry implements Comparable <TimeSlotEntry> { + + private double time_; + private PERangeList availRanges_; + + /** + * Creates a new instance of {@link TimeSlotEntry} + * @time the time associated with this entry + */ + public TimeSlotEntry(double time) { + time_ = time; + availRanges_ = null; + } + + /** + * Creates a new instance of {@link TimeSlotEntry} + * @time the time associated with this entry + * @ranges the list of ranges of PEs available + */ + public TimeSlotEntry(double time, PERangeList ranges) { + time_ = time; + availRanges_ = ranges; + } + + /** + * Gets the time associated with this entry + * @return the time associated with this entry + */ + public double getTime() { + return time_; + } + + /** + * Sets the time associated with this entry + * @param time the time associated with this entry + * @return <tt>true</tt> if the time has been set successfully or + * <tt>false</tt> otherwise. + */ + public boolean setTime(double time) { + if(time < 0) + return false; + + time_ = time; + return true; + } + + /** + * Returns the list of ranges available at this entry + * @return the list of ranges available + */ + public PERangeList getAvailRanges() { + return availRanges_; + } + + /** + * Sets the ranges of PEs available at this entry + * @param availRanges the list of ranges of PEs available + */ + public void setAvailRanges(PERangeList availRanges) { + availRanges_ = availRanges; + } + + /** + * Compares this object with the specified object for order. + * Returns a negative integer, zero, or a positive integer + * as this object is less than, equal to, or greater + * than the specified object. + * @param entry the entry to be compared. + * @return a negative integer, zero, or a positive integer as + * this entry is less than, equal to, or greater + * than the specified entry. + */ + public int compareTo(TimeSlotEntry entry) { + int result = 0; + if(time_ < entry.time_) { + result = -1; + } + else if(time_ > entry.time_) { + result = 1; + } + return result; + } + + /** + * Gets the number of PEs associated with this entry + * @return the number of PEs + */ + public int getNumPE(){ + if(availRanges_ == null) + return 0; + else + return availRanges_.getNumPE(); + } + + /** + * Creates a string representation of this entry + * @return a representation of this entry + */ + public String toString(){ + return "{time="+ time_ + "; " + + ( (availRanges_!=null) ? availRanges_ : "{[]}") + "}"; + } +} Added: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-10-16 07:12:49 UTC (rev 70) @@ -0,0 +1,314 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package gridsim.turbo; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; + +/** + * The {@link TimeSlotList} class represents a list of time slots + * that are available and can be allocated to a user. This is used + * in return to a query for free time slots in an advance reservation + * based allocation policy. + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see ARTPolicy + * @see PERange + * @see PERangeList + * @see ARParallelSpaceShared + * @see ARParallelSpaceShared#handleQueryFreeTime(ARMessage) + */ + +public class TimeSlotList { + + private static final long serialVersionUID = -3951650752024908016L; + + private ArrayList<TimeSlotEntry> list_; + private double startTime_; + private double finishTime_; + + private static final int UNKNOWN = -1; + + /** + * Default constructor. + */ + public TimeSlotList() { + list_ = new ArrayList<TimeSlotEntry>(); + startTime_ = UNKNOWN; + finishTime_ = UNKNOWN; + } + + /** + * Returns the start time of this list. That is, + * the time of the first element of this list + * @return the start time + */ + public double getStartTime() { + return startTime_; + } + + /** + * Returns the end time of this list. + * @return the end time + */ + public double getEndTime() { + return finishTime_; + } + + /** + * Sets the start time of this list. + * @param startTime the start time + */ + public void setStartTime(double startTime) { + startTime_ = startTime; + } + + /** + * Sets the end time of this list. + * @param finishTime the end time + */ + public void setFinishTime(double finishTime) { + finishTime_ = finishTime; + } + + /** + * Adds the specified element to this list. + * @param entry the entry to be added to this list + * @return <tt>true + */ + public boolean add(TimeSlotEntry entry) { + if(entry == null) { + return false; + } + else { + double entryTime = entry.getTime(); + int size = list_.size(); + int index = 0; + for (index=0; index<size; index++) { + if(list_.get(index).getTime() > entryTime) { + break; + } + } + list_.add(index, entry); + } + return true; + } + + /** + * Adds all of the elements in the specified Collection to this list, + * The behaviour of this operation is undefined if the specified + * Collection is modified while the operation is in progress. + * (This implies that the behaviour of this call is undefined if the + * specified Collection is this list, and this list is nonempty.) + * @param collection the collection to be included in this list + * @return <tt>true<tt> if the collection has been added successfully + * or <tt>false</tt> otherwise. + */ + public boolean addAll(Collection<? extends TimeSlotEntry> collection) { + boolean result = true; + + // adds the collection to the list and sets the start + // and finish time again + if(collection != null && !collection.isEmpty()) { + list_.addAll(collection); + Collections.sort(list_); + } + return result; + } + + /** + * Removes all elements from the list. + */ + public void clear() { + list_.clear(); + } + + /** + * Returns a shallow copy of this list. + * (The elements themselves are not copied.) + */ + public Object clone() { + return list_.clone(); + } + + /** + * Returns <tt>true</tt> if this list contains the specified element. + * @param entry the entry whose presence in this List is to be tested. + * @return <tt>true</tt> if the specified element is present; + * <tt>false</tt> otherwise. + */ + public boolean contains(Object entry) { + return list_.contains(entry); + } + + /** + * Returns the element at the specified position in this list. + * @param index the index of the element to return + * @return the element at the specified position in this list. + */ + public TimeSlotEntry get(int index) { + return list_.get(index); + } + + /** + * Searches for the first occurence of the given argument, + * testing for equality using the equals method. + * @param entry the entry whose index is to be returned + * @return the index of the first occurrence of the argument + * in this list; returns <tt>-1</tt> if the object is not found. + */ + public int indexOf(Object entry) { + return list_.indexOf(entry); + } + + /** + * Tests if this list has no elements. + * @return <tt>true</tt> if the list has no elements. + */ + public boolean isEmpty() { + return list_.isEmpty(); + } + + /** + * Returns an iterator over the elements in this list in proper sequence. + * @return the iterator. + */ + public Iterator<TimeSlotEntry> iterator() { + return list_.iterator(); + } + + /** + * Removes the element at a given index + * @param index the index of the element to be removed + * @return the removed element. + */ + public TimeSlotEntry remove(int index) { + return list_.remove(index); + } + + /** + * Removes a given element from the list. + * @param entry the entry to be removed + * @return <tt>true</tt> if the collection contained the + * specified entry. + */ + public boolean remove(Object entry) { + return list_.remove(entry); + } + + /** + * Returns the size of this list. + * @return the size of this list + */ + public int size() { + return list_.size(); + } + + /** + * Scans the entries in a list and returns the first time frame over + * which a request with the characteristics provided can be scheduled + * @param duration the duration of the request + * @param numPE the number of PEs required + * @return the start time or <tt>-1</tt> if not found + */ + public double getPotentialStartTime(int duration, int reqPE) { + + // the anchor index, the entry in the profile where + // the request would be placed OR the closest entry to the + // point where the anchor of the request would be placed + int anchorIndex = -1; + + // a pointer to the anchor entry (described above) + TimeSlotEntry anchorEntry = null; + + // the list of selected ranges + PERangeList intersectList = null; + + double potStartTime = -1; // keep the potential start time of the request + double potFinishTime = -1; // store the gridlet's expected finish time + + intersectList = null; + int length = list_.size(); + + Iterator<TimeSlotEntry> iterProfile = list_.iterator(); + while(iterProfile.hasNext()) { + + TimeSlotEntry entry = iterProfile.next(); + anchorEntry = entry; + anchorIndex = list_.indexOf(anchorEntry); + + // sets the start time as the time of the entry + potStartTime = entry.getTime(); + // calculates when the finish time will be if + // the gridlet is put at this position + potFinishTime = potStartTime + duration; + + // scan the profile until an entry with enough PEs is found + if(entry.getNumPE() < reqPE) { + continue; + } + else { + // if an entry with enough PEs is found, then scan the list + // from that point onwards analysing the intersection of + // the ranges available in the entries until the + // request expected completion time + intersectList = entry.getAvailRanges().clone(); + + // Look for the intersection of available ranges from + // the anchor until the end of the profile or until + // the entries are further than the expected completion time + for(int i=anchorIndex+1; i<length; i++){ + TimeSlotEntry nextEntry = list_.get(i); + if(nextEntry.getTime() > potFinishTime){ + break; + } + else{ + // if the finish time is equals to the entry time, so there + // is no need to check the intersection + if(nextEntry.getTime() < potFinishTime) { + intersectList = PERangeList.intersection(intersectList, + nextEntry.getAvailRanges()); + if(intersectList == null || intersectList.getNumPE() < reqPE) { + break; + } + } + } + } + // If a time slot with enough PEs has been found, then stop the search + if(intersectList != null && intersectList.getNumPE() >= reqPE) { + break; + } + } + } + + // if the potential finish time is larger than the end time of + // this list, then the request cannot be scheduled + if(potFinishTime > finishTime_) { + potStartTime = UNKNOWN; + } + + return potStartTime; + } + + /** + * Creates a string representation of the list + * @return a string representation + */ + public String toString() { + String result = "Availability={\n"; + for(TimeSlotEntry entry : list_){ + result += entry + "\n"; + } + result += "}"; + return result; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-14 23:06:24
|
Revision: 69 http://gridsim.svn.sourceforge.net/gridsim/?rev=69&view=rev Author: marcos_dias Date: 2007-10-14 16:06:27 -0700 (Sun, 14 Oct 2007) Log Message: ----------- A small bug that prevents the ResourceWindow from displaying the latest job scheduled has been fixed. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-12 09:02:49 UTC (rev 68) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-14 23:06:27 UTC (rev 69) @@ -95,7 +95,7 @@ * the status of the scheduling queue. The jobs are drawn as boxes in * this panel. * + the right panel has a list of gridlets or advance reservations - * received by the Grid resource allong with a panel that shows detailed + * received by the Grid resource along with a panel that shows detailed * information about a gridlet or advance reservation selected * in the list. */ @@ -217,10 +217,10 @@ case AllocationAction.GRIDLET_COMPLETED: case AllocationAction.SCHEDULE_CHANGED: - updateResourceWindow(); break; } + updateResourceWindow(); return true; } @@ -553,8 +553,8 @@ (int)(timeSpan * scaleX) - 40, SHIFT_Y - 20); } - /** - * Draws the boxes representing the gridlets + /* + * Draws the boxes representing the gridlets or advance reservations */ private void drawSchedulingQueue(ArrayList<ScheduleItem> queue, float scaleY, float scaleX, Graphics g2D) { @@ -690,7 +690,8 @@ } /* - * Highlight a job + * Highlights a schedule item. This method basically draws the item + * in the resource window with red lines. */ private void highlightItem(Graphics2D g2D, ScheduleItem item, float scaleY, float scaleX) { @@ -907,7 +908,9 @@ } /** - * Inserts a Gridlet to the JList and the vector of Gridlets + * Inserts a Gridlet to the JList and the vector of Gridlets + * @param insertItem the item to be inserted in the vector of + * schedule items and the JList */ private int insertNewItem(ScheduleItem insertItem) { int sizeVector = items_.size(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-12 09:02:46
|
Revision: 68 http://gridsim.svn.sourceforge.net/gridsim/?rev=68&view=rev Author: marcos_dias Date: 2007-10-12 02:02:49 -0700 (Fri, 12 Oct 2007) Log Message: ----------- This commit includes the advance reservation framework and some improvements in the graphical user interface. Modified Paths: -------------- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/GridInformationService.java branches/gridsim4.0-branch3/source/gridsim/Gridlet.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/util/Workload.java Added Paths: ----------- branches/gridsim4.0-branch3/examples/examples/WorkloadWithCancellation.java branches/gridsim4.0-branch3/examples/examples/WorkloadWithReservation.java branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample02.java branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExampleWithCancellation01.java branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java branches/gridsim4.0-branch3/source/gridsim/ResourceCharacteristics.java branches/gridsim4.0-branch3/source/gridsim/filter/FilterCreateAR.java branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java Removed Paths: ------------- branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java branches/gridsim4.0-branch3/source/gridsim/gui/ItemPanel.java branches/gridsim4.0-branch3/source/gridsim/gui/ScheduleItem.java Copied: branches/gridsim4.0-branch3/examples/examples/WorkloadWithCancellation.java (from rev 64, branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java) =================================================================== --- branches/gridsim4.0-branch3/examples/examples/WorkloadWithCancellation.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/WorkloadWithCancellation.java 2007-10-12 09:02:49 UTC (rev 68) @@ -0,0 +1,250 @@ +/* Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package examples; + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_system; +import gridsim.GridSimTags; +import gridsim.Gridlet; +import gridsim.IO_data; +import gridsim.ParameterException; +import gridsim.net.Link; +import gridsim.util.Workload; + +import java.util.ArrayList; + +/** + * This class is an extended version of {@link Workload}. This class + * cancels some gridlets submitted. + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see Workload + */ +public class WorkloadWithCancellation extends Workload { + private final int NUM_GRIDLETS_BETWEEN_CANCELLATIONS = 50; + // value of 1, means that the cancellation will be sent + // at the gridlet's submission time + (gridlet duration * 1) + private final double TIME_CANCELLATION = 0.5; + + /** + * Create a new {@link WorkloadWithCancellation} object <b>without</b> using + * the network extension. This means this entity directly sends Gridlets + * to a resource destination without going through a wired network. <br> + * <tt>NOTE:</tt> + * You can not use this constructor in an experiment that uses a wired + * network topology. + * + * @param name this entity name + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithCancellation(String name, String fileName, String resourceName, + int rating) throws ParameterException, Exception { + + super(name, fileName, resourceName, rating); + } + + /** + * Create a new {@link WorkloadWithCancellation} object <b>with</b> the network extension. + * This means this entity directly sends Gridlets to a destination resource + * through a link. The link is automatically created by this constructor. + * + * @param name this entity name + * @param baudRate baud rate of this link (bits/s) + * @param propDelay Propagation delay of the Link in milliseconds + * @param MTU Maximum Transmission Unit of the Link in bytes. + * Packets which are larger than the MTU should be split + * up into MTU size units. + * For example, a 1024 byte packet trying to cross a 576 + * byte MTU link should get split into 2 packets of 576 + * bytes and 448 bytes. + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li> baudRate <= 0 + * <li> propDelay <= 0 + * <li> MTU <= 0 + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre baudRate > 0 + * @pre propDelay > 0 + * @pre MTU > 0 + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithCancellation(String name, double baudRate, double propDelay, int MTU, + String fileName, String resourceName, int rating) + throws ParameterException, Exception { + + super( name, baudRate, propDelay, MTU, fileName, resourceName, rating ); + } + + /** + * Create a new Workload object <b>with</b> the network extension. + * This means this entity directly sends Gridlets to a destination resource + * through a link. The link is automatically created by this constructor. + * + * @param name this entity name + * @param link the link that will be used to connect this Workload + * to another entity or a Router. + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li>the link is empty + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre link != null + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithCancellation(String name, Link link, String fileName, + String resourceName, int rating) + throws ParameterException, Exception { + + super(name, link, fileName, resourceName, rating); + } + + //////////////////////// PRIVATE METHODS /////////////////////// + + /** + * Collects Gridlets sent and stores them into a list. + * @pre $none + * @post $none + */ + protected void collectGridlet() { + System.out.println(super.get_name() + ": Collecting Gridlets ..."); + list_ = new ArrayList(gridletID_ + 1); + + Object data = null; + Gridlet gl = null; + + int counter = 1; // starts at 1, since gridletID_ starts at 1 too + Sim_event ev = new Sim_event(); + while ( Sim_system.running() ) { + + super.sim_get_next(ev); // get the next available event + data = ev.get_data(); // get the event's data + + // handle ping request + if (ev.get_tag() == GridSimTags.INFOPKT_SUBMIT) { + processPingRequest(ev); + continue; + } + + // get the Gridlet data + if (data != null && data instanceof Gridlet) { + gl = (Gridlet) data; + +// if(gl.getGridletStatus() == Gridlet.FAILED) +// System.out.println("Gridlet failed"); +// +// if(gl.getGridletStatus() == Gridlet.CANCELED) +// System.out.println("Gridlet cancelled"); + + list_.add(gl); + counter++; + } + + // if all the Gridlets have been collected + if (counter == gridletID_) { + break; + } + } + } + + /** + * Creates a Gridlet with the given information, then submit it to a + * resource + * @param id a Gridlet ID + * @param submitTime Gridlet's submit time + * @param runTime Gridlet's run time + * @param numProc number of processors + * @pre id >= 0 + * @pre submitTime >= 0 + * @pre runTime >= 0 + * @pre numProc > 0 + * @post $none + */ + protected void submitGridlet(int id, long submitTime, int runTime, int numProc) { + + // create the gridlet + int len = runTime * rating_; // calculate a job length for each PE + Gridlet gl = new Gridlet(id, len, size_, size_); + gl.setUserID( super.get_id() ); // set the owner ID + gl.setNumPE(numProc); // set the requested num of proc + + // printing to inform user + if (gridletID_ == 1 || gridletID_ % INTERVAL == 0) { + System.out.println(super.get_name() + ": Submitting Gridlets to " + + resName_ + " ..."); + } + + // check the submit time + if (submitTime < 0) { + submitTime = 0; + } + + gridletID_++; // increment the counter + + // submit a gridlet to resource + super.send(super.output, submitTime, GridSimTags.GRIDLET_SUBMIT, + new IO_data(gl, gl.getGridletFileSize(), resID_) ); + + // check whether a cancellation has to be scheduled or not + int result = gridletID_ % NUM_GRIDLETS_BETWEEN_CANCELLATIONS; + if(result == 0) { + super.send(super.output, (submitTime + (TIME_CANCELLATION * runTime)), GridSimTags.GRIDLET_CANCEL, + new IO_data(gl, 0, resID_) ); + gridletID_++; + } + } + +} // end class + Added: branches/gridsim4.0-branch3/examples/examples/WorkloadWithReservation.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/WorkloadWithReservation.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/WorkloadWithReservation.java 2007-10-12 09:02:49 UTC (rev 68) @@ -0,0 +1,1077 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + */ + +package examples; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Enumeration; +import java.util.Random; +import java.util.zip.GZIPInputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_system; + +import gridsim.GridSim; +import gridsim.GridSimTags; +import gridsim.Gridlet; +import gridsim.IO_data; +import gridsim.ParameterException; +import gridsim.net.InfoPacket; +import gridsim.net.Link; +import gridsim.net.SimpleLink; +import gridsim.turbo.Reservation; +import gridsim.turbo.ReservationRequester; + +/** + * The main purpose of this class is to create a realistic simulation + * environment where your jobs or Gridlets are competing with others. + * In other words, the grid resource might not be available at certain times. + * In addition, the arrival time of jobs are also captured in the trace file. + * <p> + * This workload class has been modified to simulate advance reservations. + * Some parameters where included to indicate the frequency in which + * advance reservations are made. Additionally, it is possible to specify how + * long in advance the advance reservations are made. + * <p> + * This class is responsible for reading resource traces from a file and + * sends Gridlets to only <tt>one</tt> destinated resource. <br> + * <b>NOTE:</b> + * <ul> + * <li> This class can only take <tt>one</tt> trace file of the following + * format: <i>ASCII text, zip, gz.</i> + * <li> This class can be classified as <b>one grid user entity</b>. + * Hence, you need to incorporate this entity into <tt>numUser</tt> + * during {@link gridsim.GridSim#init(int, Calendar, boolean)} + * <li> If you need to use multiple trace files to submit Gridlets to + * same or different resources, then you need to create multiple + * instances of this class <tt>each with a unique entity name</tt>. + * <li> If size of the trace file is huge or contains lots of traces + * please increase the JVM heap size accordingly by using + * <tt>java -Xmx</tt> option when running the simulation. + * <li> If you are running an experiment using the network extension, + * i.e. the gridsim.net package, then you need to use + * {@link #Workload(String, double, double, int, String, String, int)} + * instead. + * <li> The default job file size for sending to and receiving from + * a resource is {@link gridsim.net.Link#DEFAULT_MTU}. + * However, you can specify + * the file size by using {@link #setGridletFileSize(int)}. + * <li> A job run time is only for 1 PE <tt>not</tt> the total number of + * allocated PEs. + * Therefore, a Gridlet length is also calculated for 1 PE.<br> + * For example, job #1 in the trace has a run time of 100 seconds + * for 2 processors. This means each processor runs + * job #1 for 100 seconds, if the processors have the same + * specification. + * </ul> + * <p> + * By default, this class follows the standard workload format as specified + * in <a href="http://www.cs.huji.ac.il/labs/parallel/workload/"> + * http://www.cs.huji.ac.il/labs/parallel/workload/</a> <br> + * However, you can use other format by calling the below methods before + * running the simulation: + * <ul> + * <li> {@link #setComment(String)} + * <li> {@link #setField(int, int, int, int, int)} + * </ul> + * + * @see gridsim.GridSim#init(int, Calendar, boolean) + * @author Marcos Dias de Assuncao (the most of the code came + * from {@link Workload} class) + * @since GridSim Turbo Alpha 0.1 + * @invariant $none + */ + +public class WorkloadWithReservation extends ReservationRequester { + + protected String fileName_; // file name + protected String resName_; // resource name + protected int resID_; // resource ID + protected int rating_; // a PE rating + protected int gridletID_; // gridletID + protected int size_; // job size for sending it through a network + protected ArrayList list_; // a list for getting all the Gridlets + + // constant + private int JOB_NUM; // job number + private int SUBMIT_TIME; // submit time of a Gridlet + private int RUN_TIME; // running time of a Gridlet + private int NUM_PROC; // number of processors needed for a Gridlet + private int REQ_NUM_PROC; // required number of processors + private int REQ_RUN_TIME; // required running time + private int MAX_FIELD; // max number of field in the trace file + private String COMMENT; // a string that denotes the start of a comment + private final int IRRELEVANT = -1; // irrelevant number + protected final int INTERVAL = 10; // number of intervals + private String[] fieldArray_; // a temp array storing all the fields + + // ADVANCE RESERVATION PROPERTIES + private double reservProbability_; + private double timeInAdvance_; + private Random numGen_; + private long seed_ = 11L*13*17*19*23+1; + + // TAGS FOR INTERNAL EVENTS + private final int GRIDLET_SUBMIT = 10; + private final int RESERVE_RESOURCES = 11; + + /** + * Create a new Workload object <b>without</b> using the network extension. + * This means this entity directly sends Gridlets to a destination resource + * without going through a wired network. <br> + * <tt>NOTE:</tt> + * You can not use this constructor in an experiment that uses a wired + * network topology. + * + * @param name this entity name + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithReservation(String name, String fileName, String resourceName, + int rating) throws ParameterException, Exception { + super(name, GridSimTags.DEFAULT_BAUD_RATE); + + // check the input parameters first + String msg = name + "(): Error - "; + if (fileName == null || fileName.length() == 0) { + throw new ParameterException(msg + "invalid trace file name."); + } + else if (resourceName == null || resourceName.length() == 0) { + throw new ParameterException(msg + "invalid resource name."); + } + else if (rating <= 0) { + throw new ParameterException(msg+"resource PE rating must be > 0."); + } + + System.out.println(name + ": Creating a workload object ..."); + init(fileName, resourceName, rating); + } + + /** + * Create a new Workload object <b>with</b> the network extension. + * This means this entity directly sends Gridlets to a destination resource + * through a link. The link is automatically created by this constructor. + * + * @param name this entity name + * @param baudRate baud rate of this link (bits/s) + * @param propDelay Propagation delay of the Link in milliseconds + * @param MTU Maximum Transmission Unit of the Link in bytes. + * Packets which are larger than the MTU should be split + * up into MTU size units. + * For example, a 1024 byte packet trying to cross a 576 + * byte MTU link should get split into 2 packets of 576 + * bytes and 448 bytes. + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li> baudRate <= 0 + * <li> propDelay <= 0 + * <li> MTU <= 0 + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre baudRate > 0 + * @pre propDelay > 0 + * @pre MTU > 0 + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithReservation(String name, double baudRate, double propDelay, int MTU, + String fileName, String resourceName, int rating) + throws ParameterException, Exception { + super( name, new SimpleLink(name+"_link", baudRate, propDelay, MTU) ); + + // check the input parameters first + String msg = name + "(): Error - "; + if (fileName == null || fileName.length() == 0) { + throw new ParameterException(msg + "invalid trace file name."); + } + else if (resourceName == null || resourceName.length() == 0) { + throw new ParameterException(msg + "invalid resource name."); + } + else if (rating <= 0) { + throw new ParameterException(msg+"resource PE rating must be > 0."); + } + + System.out.println(name + ": Creating a workload object ..."); + init(fileName, resourceName, rating); + } + + /** + * Create a new Workload object <b>with</b> the network extension. + * This means this entity directly sends Gridlets to a destination resource + * through a link. The link is automatically created by this constructor. + * + * @param name this entity name + * @param link the link that will be used to connect this Workload + * to another entity or a Router. + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li>the link is empty + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre link != null + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithReservation(String name, Link link, String fileName, + String resourceName, int rating) + throws ParameterException, Exception { + super(name, link); + + // check the input parameters first + String msg = name + "(): Error - "; + if (fileName == null || fileName.length() == 0) { + throw new ParameterException(msg + "invalid trace file name."); + } + else if (resourceName == null || resourceName.length() == 0) { + throw new ParameterException(msg + "invalid resource name."); + } + else if (rating <= 0) { + throw new ParameterException(msg+"resource PE rating must be > 0."); + } + + System.out.println(name + ": Creating a workload object ..."); + init(fileName, resourceName, rating); + } + + /** + * Gets the probability of a job in the workload + * be an advance reservation + * @return the reservation probability + */ + public double getReservationProbability() { + return reservProbability_; + } + + /** + * Sets the probability of a job in the workload + * be an advance reservation + * @param probability the reservation probability + */ + public void setReservationProbability(double probability) { + reservProbability_ = probability; + } + + /** + * Gets how long in advance an advance reservation has to + * be made. The time in advance is how long in advance to + * the submission time included in the log the reservation + * has to be made + * @return the time in advance + */ + public double getARTimeInAdvance() { + return timeInAdvance_; + } + + /** + * Sets how long in advance an advance reservation has to + * be made. The time in advance is how long in advance to + * the submission time included in the log the reservation + * has to be made + * @param time the time in advance + */ + public void setARTimeInAdvance(double time) { + timeInAdvance_ = time; + } + + /** + * Initialises all the attributes + * @param fileName trace file name + * @param resourceName resource entity name + * @param rating resource PE rating + * @pre $none + * @post $none + */ + private void init(String fileName, String resourceName, int rating) + { + fileName_ = fileName; + resName_ = resourceName; + resID_ = GridSim.getEntityId(resName_); + rating_ = rating; + gridletID_ = 1; // starts at 1 to make it the same as in a trace file + list_ = null; + size_ = Link.DEFAULT_MTU; + + timeInAdvance_ = 60 * 60; // one hour + reservProbability_ = 0D; + numGen_ = new Random(seed_); + + // if using Standard Workload Format -- don't forget to substract by 1 + // since an array starts at 0, but the field in a trace starts at 1 + JOB_NUM = 1 - 1; + SUBMIT_TIME = 2 - 1; + RUN_TIME = 4 - 1; + NUM_PROC = 5 - 1; + REQ_NUM_PROC = 8 - 1; + REQ_RUN_TIME = 9 - 1; + + COMMENT = ";"; // semicolon means the start of a comment + MAX_FIELD = 18; // standard workload format has 18 fields + fieldArray_ = null; + } + + /** + * Sets a Gridlet file size (in byte) for sending to/from a resource. + * @param size a Gridlet file size (in byte) + * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise + * @pre size > 0 + * @post $none + */ + public boolean setGridletFileSize(int size) { + if (size < 0) { + return false; + } + + size_ = size; + return true; + } + + /** + * Identifies the start of a comment line. Hence, a line that starts + * with a given comment will be ignored. + * @param comment a character that denotes the start of a comment, + * e.g. ";" or "#" + * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise + * @pre comment != null + * @post $none + */ + public boolean setComment(String comment) + { + boolean success = false; + if (comment != null && comment.length() > 0) + { + COMMENT = comment; + success = true; + } + return success; + } + + /** + * Tells this class what to look in the trace file. + * This method should be called before the start of the simulation. + * <p> + * By default, this class follows the standard workload format as specified + * in <a href="http://www.cs.huji.ac.il/labs/parallel/workload/"> + * http://www.cs.huji.ac.il/labs/parallel/workload/</a> <br> + * However, you can use other format by calling this method. + * <p> + * The parameters must be a positive integer number starting from 1. + * A special case is where <tt>jobNum == -1</tt>, meaning the job or + * gridlet ID starts at 1. + * + * @param maxField max. number of field/column in one row + * @param jobNum field/column number for locating the job ID + * @param submitTime field/column number for locating the job submit time + * @param runTime field/column number for locating the job run time + * @param numProc field/column number for locating the number of PEs + * required to run a job + * @return <tt>true</tt> if successful, <tt>false</tt> otherwise + * @pre maxField > 0 + * @pre submitTime > 0 + * @pre runTime > 0 + * @pre numProc > 0 + * @post $none + */ + public boolean setField(int maxField, int jobNum, int submitTime, + int runTime, int numProc) + { + // need to substract by 1 since array starts at 0. Need to convert, + // position in a field into the index of the array + if (jobNum > 0) { + JOB_NUM = jobNum - 1; + } + else if (jobNum == 0) + { + System.out.println(super.get_name() + + ".setField(): Invalid job number field."); + return false; + } + else { + JOB_NUM = -1; + } + + // get the max. number of field + if (maxField > 0) { + MAX_FIELD = maxField; + } + else + { + System.out.println(super.get_name() + + ".setField(): Invalid max. number of field."); + return false; + } + + // get the submit time field + if (submitTime > 0) { + SUBMIT_TIME = submitTime - 1; + } + else + { + System.out.println(super.get_name() + + ".setField(): Invalid submit time field."); + return false; + } + + // get the run time field + if (runTime > 0) { + REQ_RUN_TIME = runTime - 1; + } + else + { + System.out.println(super.get_name() + + ".setField(): Invalid run time field."); + return false; + } + + // get the number of processors field + if (numProc > 0) { + REQ_NUM_PROC = numProc - 1; + } + else + { + System.out.println(super.get_name() + + ".setField(): Invalid number of processors field."); + return false; + } + + return true; + } + + /** + * Gets a list of completed Gridlets + * @return a list of Gridlets + * @pre $none + * @post $none + */ + public ArrayList getGridletList() { + return list_; + } + + /** + * Prints the Gridlet objects + * @param history <tt>true</tt> means printing each Gridlet's history, + * <tt>false</tt> otherwise + * @pre $none + * @post $none + */ + public void printGridletList(boolean history) + { + String name = super.get_name(); + int size = list_.size(); + Gridlet gridlet; + + String indent = " "; + System.out.println(); + System.out.println("========== OUTPUT for " + name + " =========="); + System.out.println("Gridlet_ID" + indent + "STATUS" + indent + + "Resource_ID" + indent + "Cost"); + + int i = 0; + for (i = 0; i < size; i++) + { + gridlet = (Gridlet) list_.get(i); + System.out.print(indent + gridlet.getGridletID() + indent + + indent); + + // get the status of a Gridlet + System.out.print( gridlet.getGridletStatusString() ); + System.out.println( indent + indent + gridlet.getResourceID() + + indent + indent + gridlet.getProcessingCost() ); + } + + System.out.println(); + if (history == true) + { + // a loop to print each Gridlet's history + System.out.println(); + for (i = 0; i < size; i++) + { + gridlet = (Gridlet) list_.get(i); + System.out.println( gridlet.getGridletHistory() ); + + System.out.print("Gridlet #" + gridlet.getGridletID() ); + System.out.println(", length = " + gridlet.getGridletLength() + + ", finished so far = " + + gridlet.getGridletFinishedSoFar() ); + System.out.println("========================================="); + System.out.println(); + } + } + } + + /** + * Reads from a given file when the simulation starts running. + * Then submits Gridlets to a resource and collects them before exiting. + * To collect the completed Gridlets, use {@link #getGridletList()} + * @pre $none + * @post $none + */ + public void body() { + System.out.println(); + System.out.println(super.get_name() + ".body() :%%%% Start ..."); + + // create a temp array + fieldArray_ = new String[MAX_FIELD]; + + // get the resource id + if (resID_ < 0) + { + System.out.println(super.get_name() + + ".body(): Error - invalid resource name: " + resName_); + return; + } + + boolean success = false; + + // read the gz file + if (fileName_.endsWith(".gz") == true) { + success = readGZIPFile(fileName_); + } + // read the zip file + else if (fileName_.endsWith(".zip") == true) { + success = readZipFile(fileName_); + } + // read from uncompressed file as well + else { + success = readFile(fileName_); + } + + // if all the gridlets have been submitted + if (!success ) { + System.out.println(super.get_name() + + ".body(): Error - unable to parse from a file."); + return; + } + + System.out.println(super.get_name() + ": Collecting Gridlets ..."); + list_ = new ArrayList(gridletID_ + 1); + + Object data = null; + Gridlet gl = null; + + int counter = 1; // starts at 1, since gridletID_ starts at 1 too + Sim_event ev = new Sim_event(); + Object[] reservObj = null; + + while ( Sim_system.running() + && counter < gridletID_ ) { + + super.sim_get_next(ev); // get the next available event + data = ev.get_data(); // get the event's data + + // handle ping request + if (ev.get_tag() == GridSimTags.INFOPKT_SUBMIT) { + processPingRequest(ev); + continue; + } + else if (ev.get_tag() == RESERVE_RESOURCES) { + + reservObj = (Object[])ev.get_data(); + + double startTime = (Double)reservObj[0]; + int duration = (Integer)reservObj[1]; + Gridlet resGl = (Gridlet)reservObj[2]; + + // creates a new reservation + Reservation reservation = null; + reservation = super.createReservation(startTime, duration, resGl.getNumPE(), resID_); + + success = true; + if(reservation == null) { + success = false; + } + + // commit the reservation + if(success) { + // for a reservation with an even number, commits straightaway + // without sending any Gridlets yet + success = super.commitReservation(reservation.getID()); + + // submit the gridlet if success + if(success) { + + // sets the reservation id of this gridlet + resGl.setReservationID(reservation.getID()); + + // submit the gridlet to the resource + super.send(super.output, GridSimTags.SCHEDULE_NOW, GridSimTags.GRIDLET_SUBMIT, + new IO_data(resGl, resGl.getGridletFileSize(), resID_) ); + } + // if the reservation fails, then sets the status of the + // gridlet to failed and adds the gridlet to the list + else { + try { + resGl.setGridletStatus(Gridlet.FAILED); + } + catch(Exception ex) { + + } + list_.add(resGl); + } + } + counter++; + } + + // get the Gridlet data + else if (data != null && data instanceof Gridlet) { + gl = (Gridlet) data; + list_.add(gl); + counter++; + } + + // if all the Gridlets have been collected + if (counter == gridletID_) { + break; + } + } + + // shut down all the entities, including GridStatistics entity since + // we used it to record certain events. + shutdownGridStatisticsEntity(); + shutdownUserEntity(); + terminateIOEntities(); + + System.out.println(super.get_name() + ".body() : %%%% Exit ..."); + } + + //////////////////////// PROTECTED METHODS /////////////////////// + + /** + * Processes a ping request. + * @param ev a Sim_event object + * @pre ev != null + * @post $none + */ + protected void processPingRequest(Sim_event ev) + { + InfoPacket pkt = (InfoPacket) ev.get_data(); + pkt.setTag(GridSimTags.INFOPKT_RETURN); + pkt.setDestID( pkt.getSrcID() ); + + // sends back to the sender + super.send(super.output, GridSimTags.SCHEDULE_NOW, + GridSimTags.INFOPKT_RETURN, + new IO_data(pkt, pkt.getSize(), pkt.getSrcID()) ); + } + + //////////////////////// PRIVATE METHODS /////////////////////// + + /** + * Breaks a line of string into many fields. + * @param line a line of string + * @param lineNum a line number + * @pre line != null + * @pre lineNum > 0 + * @post $none + */ + private void parseValue(String line, int lineNum) + { + // skip a comment line + if (line.startsWith(COMMENT) == true) { + return; + } + + String[] sp = line.split("\\s+"); // split the fields based on a space + int i; // a counter + int len = 0; // length of a string + int index = 0; // the index of an array + + // check for each field in the array + for (i = 0; i < sp.length; i++) + { + len = sp[i].length(); // get the length of a string + + // if it is empty then ignore + if (len == 0) { + continue; + } + // if not, then put into the array + else + { + fieldArray_[index] = sp[i]; + index++; + } + } + + if (index == MAX_FIELD) { + extractField(fieldArray_, lineNum); + } + } + + /** + * Extracts relevant information from a given array + * @param array an array of String + * @param line a line number + * @pre array != null + * @pre line > 0 + */ + private void extractField(String[] array, int line) + { + try + { + Integer obj = null; + + // get the job number + int id = 0; + if (JOB_NUM == IRRELEVANT) { + id = gridletID_; + } + else + { + obj = new Integer( array[JOB_NUM].trim() ); + id = obj.intValue(); + } + + // get the submit time + Long l = new Long( array[SUBMIT_TIME].trim() ); + long submitTime = l.intValue(); + + // get the run time + obj = new Integer( array[REQ_RUN_TIME].trim() ); + int runTime = obj.intValue(); + + // if the required run time field is ignored, then use + // the actual run time + if (runTime == IRRELEVANT) + { + obj = new Integer( array[RUN_TIME].trim() ); + runTime = obj.intValue(); + } + + // according to the SWF manual, runtime of 0 is possible due + // to rounding down. E.g. runtime is 0.4 seconds -> runtime = 0 + if (runTime == 0) { + runTime = 1; // change to 1 second + } + + // get the number of allocated processors + obj = new Integer( array[REQ_NUM_PROC].trim() ); + int numProc = obj.intValue(); + + // if the required num of allocated processors field is ignored + // or zero, then use the actual field + if (numProc == IRRELEVANT || numProc == 0) + { + obj = new Integer( array[NUM_PROC].trim() ); + numProc = obj.intValue(); + } + + // finally, check if the num of PEs required is valid or not + if (numProc <= 0) + { + System.out.println(super.get_name() + ": Warning - job #" + + id + " at line " + line + " requires " + numProc + + " CPU. Change to 1 CPU."); + numProc = 1; + } + + // creates a submission/reservation event + submitGridlet(id, submitTime, runTime, numProc); + } + catch (Exception e) + { + System.out.println(super.get_name() + + ": Exception in reading file at line #" + line); + e.printStackTrace(); + } + } + + /** + * Creates a Gridlet with the given information, then submit it to a + * resource + * @param id a Gridlet ID + * @param submitTime Gridlet's submit time + * @param runTime Gridlet's run time + * @param numProc number of processors + * @pre id >= 0 + * @pre submitTime >= 0 + * @pre runTime >= 0 + * @pre numProc > 0 + * @post $none + */ + protected void submitGridlet(int id, long submitTime, int runTime, int numProc) { + // create the gridlet + int len = runTime * rating_; // calculate a job length for each PE + Gridlet gridlet = new Gridlet(id, len, size_, size_); + gridlet.setUserID( super.get_id() ); // set the owner ID + gridlet.setNumPE(numProc); // set the requested num of proc + + // check the probability of creating an advance reservation + double probAR = Math.abs(numGen_.nextDouble()); + + // check the submit time + if (submitTime < 0) { + submitTime = 0; + } + + if(probAR <= reservProbability_) { + + // calculate how long in advance the reservation is made + double timeInAdvance = timeInAdvance_ * numGen_.nextDouble(); + + // convert to seconds + double timeToReserve = submitTime - timeInAdvance; + + // if the time the reservation would be done has already + // past, then consider now as the submission time + if(timeToReserve <= 0.0D) { + timeToReserve = GridSimTags.SCHEDULE_NOW; + } + + //TODO To check the duration of the advance reservation later + Object[] reservObj = new Object[3]; + reservObj[0] = new Double(submitTime); // start time of the reservation + reservObj[1] = (int) runTime + 1; // the advance reservation duration + reservObj[2] = gridlet; // the gridlet to be submitted + + // submit an internal event to create a reservation for this gridlet + super.send(super.get_id(), timeToReserve, RESERVE_RESOURCES, reservObj); + } + else { + // printing to inform user + if (gridletID_ == 1 || gridletID_ % INTERVAL == 0) { + System.out.println(super.get_name() + ": Submitting Gridlets to " + + resName_ + " ..."); + } + + // submit a gridlet to resource + super.send(super.output, submitTime, GridSimTags.GRIDLET_SUBMIT, + new IO_data(gridlet, gridlet.getGridletFileSize(), resID_) ); + } + + gridletID_++; // increment the counter + } + + /** + * Reads a text file one line at the time + * @param fileName a file name + * @return <tt>true</tt> if reading a file is successful, <tt>false</tt> + * otherwise. + * @pre fileName != null + * @post $none + */ + private boolean readFile(String fileName) + { + boolean success = false; + BufferedReader reader = null; + try + { + FileInputStream file = new FileInputStream(fileName); + InputStreamReader input = new InputStreamReader(file); + reader = new BufferedReader(input); + + // read one line at the time + int line = 1; + while ( reader.ready() ) + { + parseValue(reader.readLine(), line); + line++; + } + + reader.close(); // close the file + success = true; + } + catch (FileNotFoundException f) + { + System.out.println(super.get_name() + + ": Error - the file was not found: " + f.getMessage()); + } + catch (IOException e) + { + System.out.println(super.get_name() + + ": Error - an IOException occurred: " + e.getMessage()); + } + finally + { + if (reader != null) + { + try { + reader.close(); // close the file + } + catch (IOException e) + { + System.out.println(super.get_name() + + ": Error - an IOException occurred: " + e.getMessage()); + } + } + } + + return success; + } + + /** + * Reads a gzip file one line at the time + * @param fileName a gzip file name + * @return <tt>true</tt> if reading a file is successful, <tt>false</tt> + * otherwise. + * @pre fileName != null + * @post $none + */ + private boolean readGZIPFile(String fileName) + { + boolean success = false; + BufferedReader reader = null; + try + { + FileInputStream file = new FileInputStream(fileName); + GZIPInputStream gz = new GZIPInputStream(file); + InputStreamReader input = new InputStreamReader(gz); + reader = new BufferedReader(input); + + // read one line at the time + int line = 1; + while ( reader.ready() ) + { + parseValue(reader.readLine(), line); + line++; + } + + reader.close(); // close the file + success = true; + } + catch (FileNotFoundException f) + { + System.out.println(super.get_name() + + ": Error - the file was not found: " + f.getMessage()); + } + catch (IOException e) + { + System.out.println(super.get_name() + + ": Error - an IOException occurred: " + e.getMessage()); + } + finally + { + if (reader != null) + { + try { + reader.close(); // close the file + } + catch (IOException e) + { + System.out.println(super.get_name() + + ": Error - an IOException occurred: " + e.getMessage()); + } + } + } + + return success; + } + + /** + * Reads a Zip file. Iterating through each entry and reading it one line + * at the time. + * @param fileName a zip file name + * @return <tt>true</tt> if reading a file is successful, <tt>false</tt> + * otherwise. + * @pre fileName != null + * @post $none + */ + private boolean readZipFile(String fileName) + { + boolean success = false; + ZipFile zipFile = null; + try + { + InputStreamReader input = null; + BufferedReader reader = null; + + // ZipFile offers an Enumeration of all the files in the Zip file + zipFile = new ZipFile(fileName); + for (Enumeration e = zipFile.entries(); e.hasMoreElements();) + { + success = false; // reset the value again + ZipEntry zipEntry = (ZipEntry) e.nextElement(); + + input = new InputStreamReader(zipFile.getInputStream(zipEntry)); + reader = new BufferedReader(input); + + // read one line at the time + int line = 1; + while ( reader.ready() ) + { + parseValue(reader.readLine(), line); + line++; + } + + reader.close(); // close the file + success = true; + } + } + catch (IOException e) + { + System.out.println(super.get_name() + + ": Error - an IOException occurred: " + e.getMessage()); + } + finally + { + if (zipFile != null) + { + try { + zipFile.close(); // close the file + } + catch (IOException e) + { + System.out.println(super.get_name() + + ": Error - an IOException occurred: " + e.getMessage()); + } + } + } + + return success; + } +} Modified: branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-10-04 06:05:40 UTC (rev 67) +++ branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-10-12 09:02:49 UTC (rev 68) @@ -50,8 +50,7 @@ * <tt>null</tt> or empty * @see gridsim.GridSim#init(int, Calendar, boolean) */ - public ARTest(String name, double baud_rate, double timeZone, - int totalJob) throws Exception { + public ARTest(String name, double baud_rate, int totalJob) throws Exception { super(name, baud_rate); this.receiveList_ = new GridletList(); this.failReservation_ = 0; @@ -108,8 +107,7 @@ // double check whether a resource supports AR or not. // In this example, all resources support AR. - if (GridSim.resourceSupportAR(intObj) == true) - { + if (GridSim.resourceSupportAR(intObj) == true) { // gets the name of a resource name = GridSim.getEntityName( intObj.intValue() ); @@ -155,11 +153,11 @@ */ private void sendReservation(ArrayList resARList, ArrayList resNameList) { // total reservation made. 1 reservation reserves 1 PE. - int totalPE = 2; - int totalReservation = list_.size(); // total number of Gridlets + int totalPE = 3; + int totalReservation = list_.size() + 2; // total number of Gridlets - // wants to reserve 1 day after the init simulation time - long time = 1 * DAY; + // wants to reserve 1 hour after the init simulation time + long time = 1 * HOUR; // each reservation requires around 10 minutes int duration = 10 * MIN; @@ -189,22 +187,25 @@ time = 1 * HOUR + duration; } - // creates a new or immediate reservation + // creates a new reservation Reservation reservation = null; boolean success = false; reservation = super.createReservation(time, duration, totalPE, resID); if(reservation != null) { - System.out.println(super.get_name() + ": reservation has been returned from "+ + System.out.println(super.get_name() + ": reservation has been accepted by "+ resName + " at time = " + GridSim.clock()); + success = true; } else { - System.out.println(super.get_name() + ": no reservation has been returned from "+ + System.out.println(super.get_name() + ": reservation has not been accepted by "+ resName + " at time = " + GridSim.clock()); failReservation_++; + success = false; } - if(reservation != null) { + // commit the reservation + if(success) { // for a reservation with an even number, commits straightaway // without sending any Gridlets yet success = super.commitReservation(reservation.getID()); @@ -218,6 +219,13 @@ " has NOT been committed successfully."); } } + + if(success && i<list_.size()) { + // then sends a gridlet to use the reservation + Gridlet grl = this.list_.get(i); + grl.setReservationID(reservation.getID()); + super.gridletSubmit(grl, resID); + } } } @@ -238,7 +246,7 @@ private GridletList createGridlet(int size, int userID) { // Creates a container to store Gridlets GridletList list = new GridletList(); - int length = 5000; + int length = 500000; for (int i = 0; i < size; i++) { // creates a new Gridlet object Gridlet gridlet = new Gridlet(i, length, 1000, 5000); Modified: branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java 2007-10-04 06:05:40 UTC (rev 67) +++ branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java 2007-10-12 09:02:49 UTC (rev 68) @@ -51,33 +51,14 @@ // Second step: Creates one or more GridResource objects // given resource name, total PE, number of Machine, time zone // and MIPS Rating. - -// // R0: vpac Compaq AlphaServer -// ARTGridResource resource0 = -// createGridResource("Resource_0", 4, 1, 10.0, 515); - - // R1: Manjra Linux PC ARTGridResource resource1 = createGridResource("Resource_1", 13, 1, 10.0, 684); -// // R2: Germany -// ARTGridResource resource2 = -// createGridResource("Resource_2", 16, 1, 1.0, 410); -// -// // R3: Czech -// ARTGridResource resource3 = -// createGridResource("Resource_3", 6, 1, 1.0, 410); -// -// // R4: Chichago -// ARTGridResource resource4 = -// createGridResource("Resource_4", 8, 1, -6.0, 377); - //------------------------------------------------ // Third step: Creates grid users ARTest[] userList = new ARTest[num_user]; ARTest user = null; // a user entity double bandwidth = 1000; // bandwidth of this user - double timeZone = 0.0; // user's time zone int totalJob = 0; // total Gridlets owned int i = 0; @@ -85,18 +66,16 @@ for (i = 0; i < num_user; i++) { // users with an even number have their time zone to GMT+8 if (i % 2 == 0) { - timeZone = 8.0; // with respect to GMT or UTC totalJob = 4; } // users with an odd number have their time zone to GMT-3 else { - timeZone = -3.0; // with respect to GMT or UTC totalJob = 5; } // creates a user entity - user = new ARTest("User_" + i, bandwidth, timeZone, totalJob); + user = new ARTest("User_" + i, bandwidth, totalJob); // put the entity into an array userList[i] = user; Modified: branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java 2007-10-04 06:05:40 UTC (rev 67) +++ branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java 2007-10-12 09:02:49 UTC (rev 68) @@ -17,7 +17,8 @@ /** - * Test Driver class for this example + * Test Driver class for this example. This example just tests + * the same features provided by the ParallelSpaceShared policy */ public class TurboAREx... [truncated message content] |
From: <mar...@us...> - 2007-10-04 06:05:36
|
Revision: 67 http://gridsim.svn.sourceforge.net/gridsim/?rev=67&view=rev Author: marcos_dias Date: 2007-10-03 23:05:40 -0700 (Wed, 03 Oct 2007) Log Message: ----------- This version contains many changes and bug fixes: + Some classes have been moved to gridsim.turbo package. + The ParallelSpaceShared policy has been changed substantially and some bugs have been fixed. For example, the policy was not compressing the schedule properly when cancelling a gridlet. This could also lead to finding the wrong anchor for a job when the completion of a job matched the completion of another job and there was a big job starting at this completion time. + Some advance reservation features have been provided, but they are still being tested. + Improvements in the graphical user interface have been made. + Some changes in SimJava classes have been made to remove the animation and log capabilities that are not used by GridSim. Removed Paths: ------------- branches/gridsim4.0-branch3/source/gridsim/filter/FilterCreateAR.java Deleted: branches/gridsim4.0-branch3/source/gridsim/filter/FilterCreateAR.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/filter/FilterCreateAR.java 2007-10-04 06:05:13 UTC (rev 66) +++ branches/gridsim4.0-branch3/source/gridsim/filter/FilterCreateAR.java 2007-10-04 06:05:40 UTC (rev 67) @@ -1,152 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * $Id: FilterCreateAR.java,v 1.1 2007/04/05 04:22:02 marcosd Exp $ - */ - -package gridsim.filter; - -import gridsim.Gridlet; -import gridsim.GridSimTags; -import eduni.simjava.Sim_predicate; -import eduni.simjava.Sim_event; - - -/** - * Look for a specific incoming event that matches a given event tag name and a - * transaction id. Incoming events with a matching tag name <b>must</b> - * contain a data object of type - * <tt>long[]</tt>, where <tt>long[0]</tt> stores the transaction id.<br> - * <tt>NOTE:</tt> This class can only be used for getting a reply or feedback - * from a {@link gridsim.ARGridResource} entity regarding to a creation of - * new reservation. - * <br><br> - * - * This class is used by {@link eduni.simjava.Sim_system} - * to select or filter an event already present in the entity's deferred queue - * (incoming buffer), or used to selectively wait for a future event. - * <br> <br> - * - * <b>An example on how to use this class:</b><br> - * Imagine we have a scenario where <tt>RESOURCE_A</tt> sends one or more events - * to <tt>Entity_B</tt> with different tag names and data objects.<br> - * <tt>Entity_B</tt> wants to get an event that contains a create reservation - * result with a transaction id of <tt>10</tt> in this example. <br> - * Therefore, inside the <tt>Entity_B</tt> code:<br> <br> - * - * <code> - * - * ... // other code <br><br> - * int transactionID = 10; <br> - * Sim_event ev = new Sim_event(); <br> - * FilterCreateAR filter = new FilterCreateAR(transactionID); <br> - * <br> - * // get an incoming event that matches a given transaction ID<br> - * super.sim_get_next(filter, ev); <br> - * <br> - * // get the matching event data <br> - * long[] data = (long[]) ev.get_data(); - * // data[0] contains transaction ID <br> - * </code> - * <br><br> - * - * <b>NOTE:</b> - * <ul> - * <li> both <tt>RESOURCE_A</tt> and <tt>Entity_B</tt> must be an instance of - * {@link eduni.simjava.Sim_entity} class. - * <li> <tt>RESOURCE_A</tt> <b>must</b> send the correct data object to - * <tt>Entity_B</tt> for events with a matching tag name. <br> - * The event data object with a matching tag name - * <b>must</b> be of type <tt>long[]</tt>, where - * <tt>long[0]</tt> contains the transaction id. - * <li> if no incoming events match the given condition, then - * {@link eduni.simjava.Sim_entity#sim_get_next(Sim_predicate, Sim_event)} - * method will wait indefinitely. - * </ul> - * - * @author Anthony Sulistio - * @since GridSim Toolkit 3.2 - * @invariant $none - */ -public class FilterCreateAR extends Sim_predicate -{ - private int tag_; - private int eventID_; - - - /** - * Finds an incoming events that matches with the given transaction ID and - * event tag name. - * @param transactionID a unique transaction ID to differentiate - * itself among other events with the same tag name - * @param tag a matching event tag name - * @pre $none - * @post $none - */ - public FilterCreateAR(int transactionID, int tag) - { - tag_ = tag; - eventID_ = transactionID; - } - - /** - * Finds an incoming events that matches with the given transaction ID and - * a default tag name of {@link GridSimTags#RETURN_AR_CREATE}. - * @param transactionID a unique transaction ID to differentiate - * itself among other events with the same tag name - * @pre $none - * @post $none - */ - public FilterCreateAR(int transactionID) - { - tag_ = GridSimTags.RETURN_AR_CREATE; - eventID_ = transactionID; - } - - /** - * Checks whether an event matches the required constraints or not.<br> - * NOTE: This method is not used directly by the user. Instead, it is - * called by {@link eduni.simjava.Sim_system}. - * - * @param ev an incoming event to compare with - * @return <tt>true</tt> if an event matches, <tt>false</tt> otherwise - * @pre ev != null - * @post $none - */ - public boolean match(Sim_event ev) - { - if (ev == null) { - return false; - } - - boolean result = false; - try - { - // find an event with a matching tag first - if ( tag_ == ev.get_tag() ) - { - Object obj = ev.get_data(); - - // if the event's data contains the correct data - if (obj instanceof long[]) - { - long[] array = (long[]) obj; - - // if the data contains the correct ID or value - if (array[0] == eventID_) { - result = true; - } - } - } - } - catch (Exception e) { - result = false; - } - - return result; - } - -} // end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-04 06:05:10
|
Revision: 66 http://gridsim.svn.sourceforge.net/gridsim/?rev=66&view=rev Author: marcos_dias Date: 2007-10-03 23:05:13 -0700 (Wed, 03 Oct 2007) Log Message: ----------- This version contains many changes and bug fixes: + Some classes have been moved to gridsim.turbo package. + The ParallelSpaceShared policy has been changed substantially and some bugs have been fixed. For example, the policy was not compressing the schedule properly when cancelling a gridlet. This could also lead to finding the wrong anchor for a job when the completion of a job matched the completion of another job and there was a big job starting at this completion time. + Some advance reservation features have been provided, but they are still being tested. + Improvements in the graphical user interface have been made. + Some changes in SimJava classes have been made to remove the animation and log capabilities that are not used by GridSim. Removed Paths: ------------- branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java Deleted: branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java 2007-10-04 06:04:43 UTC (rev 65) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java 2007-10-04 06:05:13 UTC (rev 66) @@ -1,88 +0,0 @@ -/* Evqueue.java */ - -package eduni.simjava; - -import java.util.Iterator; -import java.util.SortedSet; -import java.util.TreeSet; - -/** - * This class implements the event queue used by <code>Sim_system</code>. - * <p> - * The event queue is separated into two subqueues, the future queue and - * the deferred queue. Newly arrived events are added to the future queue - * while events that the receiving entity is unable to process are placed - * in the deferred queue. The current implementation uses a Vector to store - * the events received. - * <p> - * This class is used internally by <code>Sim_system</code> and should not be - * directly accessed. - * @see eduni.simjava.Sim_system - * @version 0.1, 25 June 1995 - * @author Ross McNab - * @author Marcos Dias de Assuncao (changed this class to use SortedSet) - */ -public class Evqueue { - private SortedSet sortedSet; - private long serial = 0; - - /** - * Allocates a new Evqueue object. - */ - public Evqueue() { - sortedSet = new TreeSet(); - } - - /** - * Remove and return the event at the top of the queue. - * @return The next event. - */ - public Sim_event pop() { - Sim_event event = (Sim_event)sortedSet.first(); - sortedSet.remove(event); - return event; - } - - /** - * Return the event at the top of the queue, without removing it. - * @return The next event. - */ - public Sim_event top() { - return (Sim_event)sortedSet.first(); - } - - /** - * Add a new event to the queue. Adding a new event to the queue preserves the - * temporal order of the events in the queue. - * @param new_event The event to be put on the queue. - */ - public void add_event(Sim_event new_event) { - // The event has to be inserted as the last of all events - // with the same event_time(). Yes, this matters. - new_event.setSerial(serial++); - sortedSet.add(new_event); - } - - /** - * Returns an interator to the sorted set - * @return the iterator - */ - public Iterator iterator() { - return sortedSet.iterator(); - } - - /** - * Returns the size of this event queue - * @return the size - */ - public int size() { - return sortedSet.size(); - } - - /** - * Clears the sorted set - */ - public void clear(){ - sortedSet.clear(); - } -} \ No newline at end of file Deleted: branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java 2007-10-04 06:04:43 UTC (rev 65) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java 2007-10-04 06:05:13 UTC (rev 66) @@ -1,3219 +0,0 @@ -/* Sim_system.java */ - -package eduni.simjava; - -import java.io.BufferedReader; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.ObjectOutputStream; -import java.text.DateFormat; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.zip.GZIPOutputStream; - -import eduni.simjava.distributions.Generator; -import eduni.simjava.distributions.Sim_random_obj; - -/** - * The <code>SimJava</code> simulation kernel. - * <p> - * This class is responsible for managing all aspects of the simulation. Instantiated entities - * are added to <code>Sim_system</code> which is responsible for synchronising their behaviour. - * Time progresses on the basis of event scheduling times. These events are held in two queues, - * instances of <code>Evqueue</code>, the future queue and the deferred queue. All the runtime - * functionality available to entities is managed by <code>Sim_system</code>. - * <p> - * In the previous versions of <code>SimJava</code>, users would use <code>Sim_system</code> - * only to initialise the simulation, add the entities, link their ports, and finally run the - * simulation. In version 2.0 <code>Sim_system</code> makes a lot more functionality available - * to the modeller. - * <p> - * Three new aspects of <code>Sim_system</code> are the definition of a transient condition, a - * termination condition, and the selection of an output analysis method to apply. All these are - * managed internally by <code>Sim_system</code> so the user is not required to include relevant - * code in the simulation's entities. To set the <b>transient condition</b> for the simulation - * the user uses a <code>set_transient_condition</code> method. The simulation's <b>termination - * condition</b> is set by using a <code>set_termination_condition</code> method. Finally, an - * <b>output analysis method</b> is selected with one of the <code>set_output_analysis</code> - * methods. - * <p> - * Available transient conditions are: - * <ul> - * <li> - * A number of event completions. In this case the simulation is considered to have entered steady state - * after a certain number of event service completions at a given entity. Event completions - * are signalled to <code>Sim_system</code> with the entities' - * <code><a href="Sim_entity.html#sim_completed(eduni.simjava.Sim_event)">sim_completed</a></code> method. - * <li> - * A specific period of simulated time. After this time period elapses the simulation is considered to - * have entered steady state. - * <li> - * The minimum-maximum method. This method allows <code>Sim_system</code> to try and identify the - * transient period based on the minimum-maximum method for a given measure. This method considers - * steady state to have been entered once a measure observation has been located which is neither - * the minimum nor the maximum of the remaining observations. - * <li> - * None. This is the default if no condition is specified. - * </ul> - * <p> - * Available termination conditions are: - * <ul> - * <li> - * A number of event completions. The simulation is terminated once a given number of events complete - * service at a given entity. This condition is similar to the relevant transient condition. - * <li> - * A specific period of simulated time. After this time period elapses the simulation is terminated. - * <li> - * A measure's confidence interval accuracy. This method allows <code>Sim_system</code> to run the - * simulation until a confidence interval for a given measure has reached a certain accuracy level. - * To use this method, the user needs to provide the measure of interest, an output analysis method - * which will be used as a variance reduction technique, the confidence level, and the desired accuracy. - * The accuracy is the ratio of the confidence interval's halfwidth over the measure's total mean. - * <li> - * None. As before this is the default if no condition is specified. Non terminating simulations have - * meaning only for animation purposes in which case a simulation is used as an elaborate demo of a - * system. - * </ul> - * <p> - * Entities may use the <code>running</code> method to check whether the simulation has completed. - * <p> - * Finally, the available output analysis methods are: - * <ul> - * <li> - * Independent replications. In this case, the simulation run is repeated a number of times - * to produce total measurements. - * <li> - * Batch means. With this method, a single, long run is performed and then the obtained observations - * are batched into batches and their means are then used to produce the total measurements. The - * number of batches used is the one that gives the least serial correlation between the batch means. - * for the majority of measures. - * <li> - * None. Again this is the default method. In this case no output analysis is performed and only - * available sample measurements are produced. - * </ul> - * <p> - * Since version 2.0 of <code>SimJava</code>, <code>Sim_system</code> also allows the modeller greater - * control over the <b>seeding</b> of the random number generators. The simulation's generators can be created - * in such a way to allow <code>Sim_system</code> to automatically seed them, ensuring well spaced - * sample sequences for the generators. The original seed to be used as well as the seed spacing desired - * can be set with the <code>set_seed_sequence</code> method. If this method is not used, the default - * seed of 4851 is used to produce seeds spaced by 100000 samples. If independent replications are used - * as an output analysis method and reseeding of the generators is desired in each subsequent replication, - * the generators need to be added to their entities. This is accomplished with the entities' - * <code><a href="Sim_entity.html#add_generator(eduni.simjava.distributions.Generator)">add_generator</a></code> method. - * Otherwise the previous replication's last seed is used as the next one's initial seed. - * <p> - * <code>Sim_system</code> also provides control over the simulation's output. The <b>trace file</b> - * (<code>sim_trace</code>) can be managed with more detail. The <code>set_trace_detail</code> method - * can be used to specify whether or not to add the default trace , trace generated by the - * entities, or trace for specific event types. In this last case, the event tags of interest can be - * supplied to <code>Sim_system</code> with a <code>track_event</code> method. The level of entity - * trace included in the trace file can be managed with the <code>set_trace_level</code> method. Finally, - * tracing can be switched off altogether with the <code>set_auto_trace</code> method. The default is - * not to produce a trace file. - * <p> - * Another major aspect of the simulation's output is the <b>simulation's report</b>. The report is - * automatically produced by <code>Sim_system</code> and includes information on the simulation - * depending on the specified conditions and parameters. The detail level of the report file - * (<code>sim_report</code>) can be modified with the <code>set_report_detail</code> method. The - * default information included are the total obtained measurements obtained as well as general - * information about the simulation run. In the case of no output analysis method having been used, - * the steady state sample measurements are presented in place of the total measurements. If an - * output analysis method has been used, <code>set_report_detail</code> can be used to include - * the sample measurements for each replication (for independent replications), or the sample - * measurements for each batch (for batch means). Finally, the original seeds used in the random - * number generators of the simulation can also be included in the report. Since version 2.0, - * the simulation's report is also available to animated simulations. - * <p> - * A <code>generate_graphs</code> method may also be used to generate <b>graphs</b> for the simulation. - * Graphs are generated for all detailed measures and present the progress of each measure's sample - * average over the progress of the simulation. Several additional information may also be displayed - * for each graph such as the mean confidence interval, the transient period, the batches etc. The - * simulation will produce a <i>".sjg"</i> file containing the simulation data. This file may then - * be opened with the <code>SimJava Graph Viewer</code>, a graph viewing utility for <code>SimJava</code> - * simulations. - * <p> - * More information on the definition of simulations and the use of <code>Sim_system</code> can be found - * at the <a href="http://www.dcs.ed.ac.uk/home/simjava/tutorial/index.html#2">SimJava Tutorial</a>. - * @see Sim_entity - * @version 2.0, 12 July 2002 - * @author Costas Simatos - * @author Marcos Dias de Assuncao (removed the animation features) - */ -public class Sim_system { - - // The types of termination and transient conditions, and output analysis methods - /** A constant representing no condition. */ - public static final int NONE = 0; - /** A constant representing a condition based on event completions. */ - public static final int EVENTS_COMPLETED = 1; - /** A constant representing a condition based on a time period. */ - public static final int TIME_ELAPSED = 2; - /** A constant representing the minimum-maximum method for transient period identification. */ - public static final int MIN_MAX = 3; - /** A constant representing the output analysis method of independent replications. */ - public static final int IND_REPLICATIONS = 4; - /** A constant representing the output analysis method of batch means. */ - public static final int BATCH_MEANS = 5; - /** A constant representing a termination condition based on a confidence interval's accuray. */ - public static final int INTERVAL_ACCURACY = 6; - - // Private fields used to store the termination condition parameters - private static int term_condition = NONE; // The termination condition to be used - private static int term_entity_id; // The id of the entity containing the measure on which the termination condition is based - private static int term_event_type; // The event tag of the events to be considered for the termination condition - private static double term_time = 0.0; // The termination time - private static double initial_term_time = 0.0; // The termination time speficied by the user - private static long initial_term_count = 0; // The count of event completions specified by the user for the termination condition - private static long term_count = 0; // The count of event completions for the termination condition - private static int[] term_count_bm; // The count of event completions for a termination condition using batch means - private static List term_times; // Stores the termination times in the case of the minimum-maximum method being used - private static long term_event_counter = 0; // The counter for termination condtion event completions - private static long transient_term_event_count = 0; // The count of termination events completed during the transient period - private static String term_measure; // The measure used in the termination condition - private static double term_accuracy; // The accuracy for the confidence interval used in the termination condition - - // Private fields used to store the termination comdition parameters - private static int trans_condition = NONE; // The transient condition being used - private static int trans_entity_id; // The id of the entity containing the measure on which the transient condition is based - private static int trans_event_type; // The event tag of events to be considered for the transient condition - private static double trans_time = -1.0; // The transient time - private static String trans_measure; // The measure on which the transient conditnion is based - private static double initial_trans_time = 0.0; // The transient time specified by the user - private static long trans_count = 0; // The count of events for the transient period estimation - private static long initial_trans_count = 0; // The count of transient events for the transient period condition specified by the user - private static long trans_event_counter = 0; // The counter for events that count towards the transient condition - - private static boolean include_transient; // Flag for specifying whether the transient condition should be considered a part of the termination condition or not - private static boolean in_steady_state = false; // Flag for checking whether the simulation is in steady state - - // Fields concerning output analysis methods - private static int output_analysis_type = NONE; // The output analysis method being used - private static boolean incomplete = true; // Flag for telling whether a simulation is complete or not - private static int replication_count = 10; // The default number of replications to be made - private static double confidence_level = 0.90; // The default confidence level - private static List replications; // Stores the data from each replication - private static double total_time_elapsed = 0.0; // The total simulated time elapsed in all replications - private static double total_transient_time = 0.0; // The total transient time elapsed in all replications - private static int min_batches = 10; // The default minimum number of batches - private static int max_batches = 20; // The default maximum number of batches - - private static Object[] run_data; // Contains all the data obtained from the run - - // Fields for the management of the trace file - private static int[] trace_tags; // The tags for which trace will be generated - private static boolean default_trace = true, // Flag for including or not the default trace - entity_trace = true, // Flag for including or not the entity trace - event_trace = true; // Flag for including or not the event specific trace - - // Private data members - private static List entities; // The current entity list - private static List backup; // A backup containing the entities in their initial state - private static Evqueue future; // The future event queue - private static Evqueue deferred; // The deferred event queue - private static double clock; // Holds the current global sim time - private static boolean running; // Flag for checking if the simulation is running - private static Semaphore onestopped; // Semaphore for synchronising entities - private static Semaphore onecompleted; // Semaphore for registering entities having completed - private static Sim_output trcout; // The output object for trace messages - private static int trace_level; // The trace level for which event trace will be generated - private static boolean auto_trace; // Should we print trace messages? - private static NumberFormat nf; // The animation number format used - private static HashMap wait_predicates; // The predicates used in entity wait methods - - // Fields concerning the simulation's report - private static long start_date; // The actual time at which the simulation started - private static boolean detailed_report = false; // The default is to produce a report that isn't detailed - private static boolean include_seeds = false; // The default is to produce a report that does not include seed information - private static List initial_seeds; // The set of initial seeds - - // Private fields used for seed generation - private static long root_seed = 4851L; // The default seed - private static int seed_spacing = 100000; // The default seed spacing - private static Sim_random_obj seed_source = new Sim_random_obj("Seed generator", root_seed); // The seed generator - private static boolean not_sampled = true; // Flag that is checked to see whether the seed generator has been sampled - - private static boolean anim_stopped = false; // Flag used to check whether (in animated versions) the user has clicked on the stop button - - // Fields concerning graph generation - private static final String suffix = ".sjg"; // The suffix for SimJava graphs - private static boolean generate_graphs = false; // Flag used to check whether or not to generate graphs - private static String graph_file = "sim_graphs" + suffix; // The default graph file to be used - - private static boolean efficient_measure_defined = false; // Flag used to check whether the simulation contains an efficient measure - - // ADDED BY MARCOS - 2007-09-07 - private static boolean paused = false; - private static Object syncObj = new Object(); - - /** - * Do not a constructor for <code>Sim_system</code>. Use an <code>initialise</code> method instead. - */ - public Sim_system() { - throw new Sim_exception("Attempt to instantiate Sim_system."); - } - - /** - * Initialise the simulation for standalone simulations. This function should be called - * at the start of the simulation. - */ - public static void initialise() { - initialise(new Sim_outfile()); - } - - /** - * Initialise the system to draw <code>simdiag</code> diagrams. This method - * should be used directly only by expert users. - * @param out The <code>Sim_output</code> instance that will receive the simulation trace - */ - public static void initialise(Sim_output out) { - System.out.println("Initialising..."); - entities = new ArrayList(); - future = new Evqueue(); - deferred = new Evqueue(); - wait_predicates = new HashMap(); - clock = 0.0; - running = false; - onestopped = new Semaphore(0); - onecompleted = new Semaphore(0); - trcout = out; - trcout.initialise(); - trace_level = 0xff; - auto_trace = false; - // Set the default number format - nf = NumberFormat.getInstance(); - nf.setMaximumFractionDigits(4); - nf.setMinimumFractionDigits(2); - } - - /** - * Get the number format used for generating times in trace lines. - * @return The number format - */ - public static NumberFormat getNumberFormat() { return nf; } - - // The two standard predicates - - /** A standard predicate that matches any event. */ - public static Sim_any_p SIM_ANY = new Sim_any_p(); - /** A standard predicate that does not match any events. */ - public static Sim_none_p SIM_NONE = new Sim_none_p(); - - // Public access methods - - /** - * Get the current simulation time. This method is identical to <code>sim_clock()</code> and - * is present for compatibility with existing simulations. - * @return The simulation time - */ - public static double clock() { return clock; } - - /** - * Get the current simulation time, as a runtime method for entities. - * @return The simulation time - */ - public static double sim_clock() { return clock; } - - /** - * Get the current number of entities in the simulation. - * @return The number of entities - */ - public static int get_num_entities() { return entities.size(); } - - /** - * Get the current trace level (initially <code>0xff</code>), which - * controls trace output. This method is identical to <code>get_trace_level()</code> and - * is present for compatibility with existing simulations. - * @return The trace level - */ - public static int get_trc_level() { return trace_level; } // For compatibility with previous versions - - /** - * Get the current trace level (initially <code>0xff</code>), which - * controls trace output. - * @return The trace level - */ - public static int get_trace_level() { return trace_level; } - - /** - * Get the entity with a given id. - * @param id The entity's unique id number - * @return The entity, or <code>null</code> if it could not be found - * @throws Sim_exception If the entity was not found. This error can be left unchecked. - */ - public static Sim_entity get_entity(int id) { - if ((id < 0) || (id >= entities.size())) { - throw new Sim_exception("Entity " + id + " does not exist."); - } - return (Sim_entity)entities.get(id); - } - - /** - * Get the entity with a given name. - * @param name The entity's name - * @return The entity - * @throws Sim_exception If the entity was not found. This error can be left unchecked. - */ - public static Sim_entity get_entity(String name) { - Sim_entity ent; - int entities_size = entities.size(); - for (int i=0; i < entities_size; i++) { - ent = (Sim_entity)entities.get(i); - if (name.compareTo(ent.get_name()) == 0) { - return ent; - } - } - throw new Sim_exception("Entity " + name + " does not exist."); - } - - /** - * Get the id of an entity with a given name. - * @param name The entity's name - * @return The entity's unique id number - * @throws Sim_exception If the entity was not found. This error can be left unchecked. - */ - public static int get_entity_id(String name) { - int id = entities.indexOf(get_entity(name)); - if (id == -1) { - throw new Sim_exception("Entity " + name + " does not exist."); - } - return id; - } - - // ADDED BY MARCOS TO GET THE LIST OF ENTITIES IN THE SIMULATION - - /** - * Returns a list of entities created for the simulation - * @return the entity iterator - */ - public static LinkedList<Sim_entity> getEntityList(){ - // create a new list to prevent the user from changing - // the list of entities used by Sim_system - LinkedList<Sim_entity> list = new LinkedList<Sim_entity>(); - list.addAll(entities); - return list; - } - - // END OF METHODS ADDED BY MARCOS - - /** - * Get the currently running entity. - * @return The entity, or <code>null</code> if none are running - */ - public static Sim_entity current_ent() { - return (Sim_entity)Sim_entity.currentThread(); - } - - // Public update methods - - /** - * Set the trace level which controls entity trace output. This method is identical to - * <code>set_trace_level()</code> and is present for compatibility with existing simulations. - * @param level The new level - */ - public static void set_trc_level(int level) { auto_trace = true; trace_level = level; } - - /** - * Set the trace level which controls entity trace output. - * @param level The new level - */ - public static void set_trace_level(int level) { auto_trace = true; trace_level = level; } - - /** - * Switch the trace messages on and off. - * @param on If <code>true</code> then the messages are switched on, if <code>false</code> - they are switched off. - */ - public static void set_auto_trace(boolean on) { auto_trace = on; } - - /** - * Add a new entity to the simulation. This is present for compatibility with existing - * simulations since entities are automatically added to the simulation upon instantiation. - * @param e The new entity - */ - public static void add(Sim_entity e) { - Sim_event evt; - if (running) { - // Post an event to make this entity - evt = new Sim_event(Sim_event.CREATE,clock,current_ent().get_id(),0,0, e); - future.add_event(evt); - } else { - if (e.get_id()==-1) { // Only add once! - e.set_id(entities.size()); - entities.add(e); - } - } - } - - /** - * Internal method used to add a new entity to the simulation when the simulation is running. - * It should <b>not</b> be called from - * user simulations. - * @param e The new entity - */ - static synchronized void add_entity_dynamically(Sim_entity e) { - e.set_id(entities.size()); - if (e == null) { - throw new Sim_exception("Adding null entity."); - } else { - print_message("Adding: " + e.get_name()); - } - entities.add(e); - e.start(); - onestopped.p(); - } - - /** - * Link the ports of two entities so that events can be scheduled. - * @param ent1 The name of the first entity - * @param port1 The name of the port on the first entity - * @param ent2 The name of the second entity - * @param port2 The name of the port on the second entity - */ - public static void link_ports(String ent1, String port1, String ent2, String port2) { - Sim_port p1,p2; - Sim_entity e1, e2; - e1 = get_entity(ent1); - e2 = get_entity(ent2); - if (e1 == null) { - throw new Sim_exception("Sim_system: " + ent1 + " not found."); - } else if (e2==null) { - throw new Sim_exception("Sim_system: " + ent2 + " not found."); - } else { - p1 = e1.get_port(port1); - p2 = e2.get_port(port2); - if (p1 == null) { - throw new Sim_exception("Sim_system: " + port1 + " not found."); - } else if (p2==null) { - throw new Sim_exception("Sim_system: " + port2 + " not found."); - } else { - p1.connect(e2); - p2.connect(e1); - } - } - } - - /** - * Internal method used to run one tick of the simulation. This method should <b>not</b> be - * called in simulations. - * @return <code>true</code> if the event queue is empty, <code>false</code> otherwise - */ - public static boolean run_tick() { - Sim_entity ent; - int num_started; - boolean queue_empty; - num_started = 0; - int entities_size = entities.size(); - for (int i=0; i < entities_size; i++) { - ent = (Sim_entity)entities.get(i); - if (ent.get_state() == Sim_entity.RUNNABLE) { - ent.restart(); - num_started++; - } - } - // Wait for them all to halt - for (int i=0; i<num_started; i++) { - onestopped.p(); - } - - // If there are more future events then deal with them - if (future.size() > 0) { - queue_empty = false; - Sim_event first = future.pop(); - process_event(first); - // Check if next events are at same time... - boolean trymore = (future.size()>0); - while (trymore) { - Sim_event next = future.top(); - if (next.event_time() == first.event_time()) { - process_event(future.pop()); - trymore = (future.size()>0); - } else trymore = false; - } - } else { - queue_empty = true; - running = false; - print_message("Sim_system: No more future events"); - } - return queue_empty; - } - - - /** - * Internal method used to stop the simulation. This method should <b>not</b> be used directly. - */ - public static void run_stop() { - print_message("Simulation completed."); - trcout.close(); - } - - // - // Package level methods - // - - /** - * Get the object to which the simulation trace is sent. - * @return The trace handler - */ - public static Sim_output get_trcout() { return trcout; } - - // Entity service methods - - // Called by an entity just before it become non-RUNNABLE - static void paused() { onestopped.v(); } - - // Used to hold an entity for some time - static synchronized void hold(int src, double delay) { - Sim_event e = new Sim_event(Sim_event.HOLD_DONE,clock+delay,src); - future.add_event(e); - ((Sim_entity)entities.get(src)).set_state(Sim_entity.HOLDING); - if (auto_trace && default_trace) { - trace(src, "start processing"); - } - } - - // Used to pause an entity for some time - static synchronized void pause(int src, double delay) { - Sim_event e = new Sim_event(Sim_event.HOLD_DONE,clock+delay,src); - future.add_event(e); - ((Sim_entity)entities.get(src)).set_state(Sim_entity.HOLDING); - if (auto_trace && default_trace) { - trace(src, "start pausing"); - } - } - - // Used to send an event from one entity to another - static synchronized void send(int src, int dest, double delay, int tag, Object data) { - if (delay < 0.0) { - throw new Sim_exception("Sim_system: Send delay can't be negative."); - } - Sim_event e = new Sim_event(Sim_event.SEND, clock+delay, src, dest, tag, data); - if (auto_trace && (default_trace || (event_trace && is_trace_tag(tag)))) { - trace(src, "scheduling event type "+tag+" for "+ - ((Sim_entity)entities.get(dest)).get_name()+ - " with delay "+delay); - } - future.add_event(e); - } - - // Sets an entity's state to be waiting. The predicate used to wait for an event is now - // passed to Sim_system. Only events that satisfy the predicate will be passed to the - // entity. This is done to avoid unnecessary context switches. - static synchronized void wait(int src, Sim_predicate p) { - ((Sim_entity)entities.get(src)).set_state(Sim_entity.WAITING); - if (p != SIM_ANY) { - // If a predicate has been used store it in order to check it - wait_predicates.put(new Integer(src), p); - } - if (auto_trace && default_trace) { - trace(src,"waiting for an event"); - } - } - - // Checks if events for a specific entity are present in the deferred event queue - static synchronized int waiting(int d, Sim_predicate p) { - int count = 0; - Sim_event event; - Iterator iterator = deferred.iterator(); - while (iterator.hasNext()) { - event = (Sim_event)iterator.next(); - if ((event.get_dest() == d) && (p.match(event))) { - count++; - } - } - return count; - } - - // Selects an event matching a predicate - static synchronized void select(int src, Sim_predicate p) { - Sim_event ev = null; - boolean found = false; - Iterator iterator = deferred.iterator(); - while (iterator.hasNext()) { - ev = (Sim_event)iterator.next(); - if (ev.get_dest() == src) { - if (p.match(ev)) { - iterator.remove(); - found = true; - break; - } - } - } - if (found) { - ((Sim_entity)entities.get(src)).set_evbuf((Sim_event)ev.clone()); - if (auto_trace && (default_trace || (event_trace &&is_trace_tag(ev.get_tag())))) { - trace(src,"selected event type " + ev.get_tag() + " (event time was "+ev.event_time()+")"); - } - } else { - ((Sim_entity)entities.get(src)).set_evbuf(null); - if (auto_trace && (default_trace)) { - trace(src,"no event selected"); - } - } - } - - // Removes an event from the event queue - static synchronized void cancel(int src, Sim_predicate p) { - Sim_event ev = null; - boolean found = false; - int future_size = future.size(); - Iterator iter = future.iterator(); - while(iter.hasNext()){ - ev = (Sim_event)iter.next(); - if (ev.get_src() == src) { - if (p.match(ev)) { - iter.remove(); - found = true; - break; - } - } - } - -// for (int i=0; i < future_size; i++) { -// ev = (Sim_event)future.get(i); -// if (ev.get_src() == src) { -// if (p.match(ev)) { -// future.remove(i); -// found = true; -// break; -// } -// } -// } - - if (found) { - ((Sim_entity)entities.get(src)).set_evbuf((Sim_event)ev.clone()); - if (auto_trace && (default_trace || (event_trace && is_trace_tag(ev.get_tag())))) { - trace(src,"cancelled event type " + ev.get_tag() + " (event time was "+ev.event_time()+")"); - } - } else { - ((Sim_entity)entities.get(src)).set_evbuf(null); - if (auto_trace && default_trace) { - trace(src,"no event cancelled"); - } - } - } - - // Puts an event into the deferred queue - static synchronized void putback(Sim_event ev) { deferred.add_event(ev); } - - // - // Private internal methods - // - - // Processes an event - private static void process_event(Sim_event e) { - - // ADDED BY MARCOS TO ALLOW THE - // SIMULATION TO BE PAUSED - while(paused){ - synchronized(syncObj){ - try { - syncObj.wait(); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - } - } - - int dest, src; - Sim_entity dest_ent; - // Update the system's clock - if (e.event_time() < clock) { - throw new Sim_exception("Sim_system: Past event detected."); - } - clock = e.event_time(); - // Ok now process it - switch(e.get_type()) { - case(Sim_event.ENULL): - throw new Sim_exception("Sim_system: Event has a null type."); - case(Sim_event.CREATE): - Sim_entity newe = (Sim_entity)e.get_data(); - add_entity_dynamically(newe); - break; - case(Sim_event.SEND): - // Check for matching wait - dest = e.get_dest(); - if (dest < 0) { - throw new Sim_exception("Sim_system: Attempt to send to a null entity detected."); - } else { - int tag = e.get_tag(); - if (((dest != e.get_src()) || (tag != 9999)) && ((Sim_entity)entities.get(dest)).has_stat()) { - ((Sim_entity)entities.get(dest)).update(Sim_stat.ARRIVAL, tag, clock); - } - dest_ent = (Sim_entity)entities.get(dest); - if (dest_ent.get_state() == Sim_entity.WAITING) { - Integer destObj = new Integer(dest); - Sim_predicate p = (Sim_predicate)wait_predicates.get(destObj); - if ((p == null) || (tag == 9999) || (p.match(e))) { - dest_ent.set_evbuf((Sim_event)e.clone()); - dest_ent.set_state(Sim_entity.RUNNABLE); - wait_predicates.remove(destObj); - } else { - deferred.add_event(e); - } - } else { - deferred.add_event(e); - } - } - break; - case(Sim_event.HOLD_DONE): - src = e.get_src(); - if (src<0) { - throw new Sim_exception("Sim_system: Null entity holding."); - } else { - ((Sim_entity)entities.get(src)).set_state(Sim_entity.RUNNABLE); - } - break; - } - } - - /** - * Set the sample generators' seed sequence. If this method is not called the defaults - * are 4851 as the root seed and 100000 as the desired sample spacing. - * @param seed_specing The seed spacing - * @param root_seed The seed used to generate all the simulation's seeds - */ - public static void set_seed_sequence(int seed_spacing, long root_seed) { - Sim_system.seed_spacing = seed_spacing; - Sim_system.root_seed = root_seed; - seed_source.set_seed(root_seed); - not_sampled = true; - } - - /** - * Set the sample generators' seed spacing. - * @param new_spacing The new seed spacing - */ - public static void set_spacing(int new_spacing) { - seed_spacing = new_spacing; - } - - /** - * Get the sample generators' seed spacing. - * @return The seed spacing - */ - public static int get_spacing() { - return seed_spacing; - } - - /** - * Set the sample generators' root seed. This is the seed used to generate the initial seeds - * for the simulation's sample generators. - * @param new_seed The new root seed - */ - public static void set_seed(long new_seed) { - root_seed = new_seed; - seed_source.set_seed(new_seed); - not_sampled = true; - } - - /** - * Get the sample generator's root seed. - * @return The root seed - */ - public static long get_root_seed() { - return root_seed; - } - - /** - * Generate the next seed based on the root seed and the seed spacing. This method - * is automatically called and doesn't need to be included on user simulations. - * @return The next well spaced seed - */ - public static long next_seed() { - long new_seed = seed_source.get_seed(); - if ((new_seed == root_seed) && not_sampled) { - not_sampled = false; - } else { - for (int i=0; i<seed_spacing; i++) { - seed_source.sample(); - } - new_seed = seed_source.get_seed(); - } - return new_seed; - } - - // Called when an event is considered to have completed service. If the event that completed is the one - // that determines the run length condition. - static synchronized void job_completed(int entity, int event_tag) { - if (term_condition == EVENTS_COMPLETED) { - if ((entity == term_entity_id) && (event_tag == term_event_type)) { - term_event_counter++; - if (trans_condition == MIN_MAX) { - term_times.add(new Double(clock)); - } - } - } - if (trans_condition == EVENTS_COMPLETED) { - if ((entity == trans_entity_id) && (event_tag == trans_event_type)) { - trans_event_counter++; - } - } - if (auto_trace && (default_trace || (event_trace && is_trace_tag(event_tag)))) { - trace(entity, "event type " + event_tag + " completed service"); - } - } - - // Called to update the count of collected observations of interest. This is done in the case of - // a termination condition based on collected observations and interval accuracy. - static synchronized void observation_collected(int entity, String measure) { - if ((term_condition == INTERVAL_ACCURACY) && - (entity == term_entity_id) && - (measure.equals(term_measure)) && - in_steady_state) { - term_event_counter++; - } - } - - /** - * Internal method used to initialise the simulation. This should <b>not</b> be called from user simulations. - */ - public static void run_initialise() { - start_date = System.currentTimeMillis(); - if (term_condition == INTERVAL_ACCURACY) { - switch (output_analysis_type) { - case IND_REPLICATIONS: - initial_term_count = 2500; - break; - case BATCH_MEANS: - term_count_bm = new int[2]; - term_count_bm[0] = 600; - term_count_bm[1] = 800; - term_count = 800; - break; - } - } else if (term_condition == EVENTS_COMPLETED) { - term_count = initial_term_count; - } else { - term_time = initial_term_time; - } - trans_count = initial_trans_count; - if (output_analysis_type == IND_REPLICATIONS) { - // Make a backup of the entities. This is done in order to perform independent replications - backup = new ArrayList(); - Sim_entity ent; - int entities_size = entities.size(); - for (int i=0; i < entities_size; i++) { - ent = (Sim_entity)entities.get(i); - try { - backup.add((Sim_entity)ent.clone()); - } catch (CloneNotSupportedException ex) { - throw new Sim_exception("Could not make backup of entity " + ent.get_name() + "."); - } - } - } - // Get the initial seeds used in the entities. - initial_seeds = new ArrayList(); - int entities_size = entities.size(); - for (int i=0; i < entities_size; i++) { - Sim_entity ent = (Sim_entity)entities.get(i); - String ent_name = ent.get_name(); - List generators = ent.get_generators(); - if (generators.size() == 0) { - continue; - } - List gens = new ArrayList(); - int generators_size = generators.size(); - for (int j=0; j < generators_size; j++) { - Generator gen = (Generator)generators.get(j); - gens.add(new Object[] {gen.get_name(), new Long(gen.get_seed())}); - } - initial_seeds.add(new Object[] {ent_name, gens}); - } - } - - /** - * Internal method used to start the simulation. This method should <b>not</b> be used by user simulations. - */ - public static void run_start() { - if (output_analysis_type == IND_REPLICATIONS) { - int count = 1; - if (replications != null) { - count = replications.size() + 1; - } - print_message("Performing replication #" + count + "."); - } - running = true; - // Start all the entities' threads - int entities_size = entities.size(); - for (int i=0; i < entities_size; i++) { - ((Sim_entity)entities.get(i)).start(); - } - // Wait until they're all up and ready - for (int i=0; i < entities_size; i++) { - onestopped.p(); - } - print_message("Entities started."); - } - - /** - * Specify a termination condition based on event completions at a specific entity. - * @param type The termination condition type. This must be set to <code>EVENTS_COMPLETED</code>. - * @param entity The name of the entity whose events will be used for the termination condition - * @param event_type The event tag of the events to be counted towards the termination condition - * @param count The event completion count that when reached, will satisfy the termination condition - * @param include_transient <code>true</code> if the number of completions provided should only apply to - * completions in steady state. <code>false</code> if they should apply to the entire - * run length. - */ - public static void set_termination_condition(int type, String entity, int event_type, long count, boolean include_transient) { - if (type != EVENTS_COMPLETED) { - throw new Sim_exception("The method used must be passed a condition based on completed events."); - } else if (count <= 0) { - throw new Sim_exception("The count for events completed must be positive."); - } else if (term_condition != NONE) { - throw new Sim_exception("You can't specify two termination conditions."); - } - term_condition = type; - term_entity_id = get_entity_id(entity); - term_event_type = event_type; - initial_term_count = count; - Sim_system.include_transient = include_transient; - } - - /** - * Specify a termination condition based on the simulation time elapsed. - * @param type The termination condition type. This must be set to <code>TIME_ELAPSED</code>. - * @param time The simulated time after which the termination condition will be satisfied - * @param include_transient <code>true</code> if the condition's time period should be considered - * only after steady state has been reached, <code>false</code> if it should - * be considered from the beginning of the simulation. - */ - public static void set_termination_condition(int type, double time, boolean include_transient) { - if (type != TIME_ELAPSED) { - throw new Sim_exception("The method used must be passed a condition based on the elapsed simulation time."); - } else if (time <= 0.0) { - throw new Sim_exception("The simulation termination time completed must be positive."); - } else if (term_condition != NONE) { - throw new Sim_exception("You can't specify two termination conditions."); - } - term_condition = type; - initial_term_time = time; - Sim_system.include_transient = include_transient; - } - - /** - * Specify a termination condition based on the confidence interval accuracy obtained for a custom measure. This - * condition is considered only once the transient period has elapsed. The accuracy is the ratio of the confidence - * interval's halfwidth over the measure's total mean. - * @param type The termination condition type. This must be set to <code>INTERVAL_ACCURACY</code>. - * @param output_analysis_type The output analysis method to be used as a variance reduction technique - * @param level The confidence level for which the confidence interval will be calculated - * @param accuracy The accuracy that is required to satisfy the termination condition - * @param entity The name of the entity that contains the measure upon which the termination condition is based - * @param measure The name of the custom measure upon which the termination condition is based - */ - public static void set_termination_condition(int type, int output_analysis_type, double level, double accuracy, String entity, String measure) { - if (type != INTERVAL_ACCURACY) { - throw new Sim_exception("The method used must be passed a condition based on the accuracy of a confidence interval."); - } else if ((output_analysis_type != IND_REPLICATIONS) && (output_analysis_type != BATCH_MEANS)) { - throw new Sim_exception("The output analysis method to be used must be either IND_REPLICATIONS or BATCH_MEANS."); - } else if ((level <= 0.0) || (level >= 1.0)) { - throw new Sim_exception("The confidence level must be between 0.0 and 1.0."); - } else if (accuracy <= 0.0) { - throw new Sim_exception("The interval accuracy tolerance must be greater than 0.0."); - } else if (Sim_system.output_analysis_type != NONE) { - throw new Sim_exception("When using this termination condition no other output analysis method can be specified."); - } else if (trans_condition == MIN_MAX) { - throw new Sim_exception("This termination condition can't be used when the minimum-maximum method is used."); - } else if (term_condition != NONE) { - throw new Sim_exception("You can't specify two termination conditions."); - } else if ((output_analysis_type == BATCH_MEANS) && (efficient_measure_defined)) { - throw new Sim_exception("Batch means may not be used when efficient measures are defined."); - } - term_entity_id = get_entity_id(entity); - Sim_stat stat = ((Sim_entity)entities.get(term_entity_id)).get_stat(); - if (stat == null) { - throw new Sim_exception("No measures have been defined for " + entity + "."); - } - int measure_type = stat.get_type(measure); - if (measure_type == -1) { - throw new Sim_exception(measure + " has not been defined for " + entity + "."); - } - term_condition = type; - term_measure = measure; - Sim_system.output_analysis_type = output_analysis_type; - confidence_level = level; - term_accuracy = accuracy; - replication_count = 5; - } - - /** - * Specify a termination condition based on the confidence interval accuracy obtained for a default measure. This - * condition is considered only once the transient period has elapsed. The accuracy is the ratio of the confidence - * interval's halfwidth over the measure's total mean. - * @param type The termination condition type. This must be set to <code>INTERVAL_ACCURACY</code>. - * @param output_analysis_type The output analysis method to be used as a variance reduction technique - * @param level The confidence level for which the confidence interval will be calculated - * @param accuracy The accuracy that is required to satisfy the termination condition - * @param entity The name of the entity that contains the measure upon which the termination condition is based - * @param measure The <code>int</code> constant that represents the default measure upon which the termination - * condition is based - */ - public static void set_termination_condition(int type, int output_analysis_type, double level, double accuracy, String entity, int measure) { - if (type != INTERVAL_ACCURACY) { - throw new Sim_exception("The method used must be passed a condition based on the accuracy of a confidence interval."); - } else if ((output_analysis_type != IND_REPLICATIONS) && (output_analysis_type != BATCH_MEANS)) { - throw new Sim_exception("The output analysis method to be used must be either IND_REPLICATIONS or BATCH_MEANS."); - } else if ((level <= 0.0) || (level >= 1.0)) { - throw new Sim_exception("The confidence level must be between 0.0 and 1.0."); - } else if (accuracy <= 0.0) { - throw new Sim_exception("The interval accuracy tolerance must be greater than 0.0."); - } else if (Sim_system.output_analysis_type != NONE) { - throw new Sim_exception("When using this termination condition no other output analysis method can be specified."); - } else if (trans_condition == MIN_MAX) { - throw new Sim_exception("This termination condition can't be used when the minimum-maximum method is used."); - } else if (term_condition != NONE) { - throw new Sim_exception("You can't specify two termination conditions."); - } else if ((output_analysis_type == BATCH_MEANS) && (efficient_measure_defined)) { - throw new Sim_exception("Batch means may not be used when efficient measures are defined."); - } - term_entity_id = get_entity_id(entity); - Sim_stat stat = ((Sim_entity)entities.get(term_entity_id)).get_stat(); - if (stat == null) { - throw new Sim_exception("No measures have been defined for " + entity + "."); - } - String measure_name = stat.get_name_default(measure); - int measure_type = stat.get_type(measure_name); - if (measure_type == -1) { - throw new Sim_exception(measure_name + " has not been defined for " + entity + "."); - } - term_condition = type; - term_measure = measure_name; - Sim_system.output_analysis_type = output_analysis_type; - confidence_level = level; - term_accuracy = accuracy; - replication_count = 5; - } - - /** - * Specify a transient condition using the minimum-maximum method for a custom measure. - * The minimum-maximum method considers the simulation to have entered steady state after the first - * observation of the given measure is found that is neither the minimum nor the maximum of the remaining - * observations. - * @param type The transient condition type. This must be set to <code>MIN_MAX</code>. - * @param entity The name of the entity that contains the measure upon which the minimum-maximum method will be - * applied - * @param measure The name of the custom measure upon which the minimum-maximum method will be applied - */ - public static void set_transient_condition(int type, String entity, String measure) { - if (type != MIN_MAX) { - throw new Sim_exception("The method used must be passed a condition based on minimum-maximum values of observations of a specific entity's measure."); - } else if (trans_condition != NONE) { - throw new Sim_exception("You can't specify two transient conditions."); - } else if ((term_condition == INTERVAL_ACCURACY) || (term_condition == NONE)) { - throw new Sim_exception("The minimum-maximum method can only be used with a termination of event completions or elapsed time."); - } else if (efficient_measure_defined) { - throw new Sim_exception("The minimum-maximum method can't be used with efficient measures."); - } - trans_condition = type; - trans_entity_id = get_entity_id(entity); - Sim_stat stat = ((Sim_entity)entities.get(trans_entity_id)).get_stat(); - if (stat == null) { - throw new Sim_exception("No measures have been defined for " + entity + "."); - } - int measure_type = stat.get_type(measure); - if (measure_type == -1) { - throw new Sim_exception(measure + " has not been defined for " + entity + "."); - } else if (((measure_type != Sim_stat.STATE_BASED) && (measure_type != Sim_stat.INTERVAL_BASED)) || (measure.equals("Utilisation"))) { - throw new Sim_exception(measure + " of " + entity + " has invalid type for a transient period estimator."); - } - trans_measure = measure; - term_times = new ArrayList(); - } - - /** - * Specify a transient condition using the minimum-maximum method for a default measure. - * The minimum-maximum method considers the simulation to have entered steady state after the first - * observation of the given measure is found that is neither the minimum nor the maximum of the remaining - * observations. - * @param type The transient condition type. This must be set to <code>MIN_MAX</code>. - * @param entity The name of the entity that contains the measure upon which the minimum-maximum method will be - * applied - * @param measure The <code>int</code> constant that represents the default measure upon which the minimum-maximum - * method will be applied - */ - public static void set_transient_condition(int type, String entity, int measure) { - if (type != MIN_MAX) { - throw new Sim_exception("The method used must be passed a condition based on minimum-maximum values of observations of a specific entity's measure."); - } else if (trans_condition != NONE) { - throw new Sim_exception("You can't specify two transient conditions."); - } else if ((term_condition == INTERVAL_ACCURACY) || (term_condition == NONE)) { - throw new Sim_exception("The minimum-maximum method can only be used with a termination of event completions or elapsed time."); - } else if (efficient_measure_defined) { - throw new Sim_exception("The minimum-maximum method can't be used with efficient measures."); - } - trans_condition = type; - trans_entity_id = get_entity_id(entity); - Sim_stat stat = ((Sim_entity)entities.get(trans_entity_id)).get_stat(); - if (stat == null) { - throw new Sim_exception("No measures have been defined for " + entity + "."); - } - String measure_name = stat.get_name_default(measure); - int measure_type = stat.get_type(measure_name); - if (measure_type == -1) { - throw new Sim_exception(measure_name + " has not been defined for " + entity + "."); - } else if (((measure_type != Sim_stat.STATE_BASED) && (measure_type != Sim_stat.INTERVAL_BASED)) || (measure_name.equals("Utilisation"))) { - throw new Sim_exception(measure_name + " of " + entity + " has invalid type for a transient period estimator."); - } - trans_measure = measure_name; - term_times = new ArrayList(); - } - - /** - * Specify a transient condition based on event completions at a specific entity. - * @param type The transient condition type. This must be set to <code>EVENTS_COMPLETED</code>. - * @param entity The name of the entity whise event completions will be counted towards this condition - * @param event_type The event tag of the events whose completions will be counted towards this condition - * @param count The number of event completions after which the condition will be satisfied - */ - public static void set_transient_condition(int type, String entity, int event_type, long count) { - if (type != EVENTS_COMPLETED) { - throw new Sim_exception("The method used must be passed a condition based on completed events."); - } else if (count <= 0) { - throw new Sim_exception("The count for events completed must be positive."); - } else if (trans_condition != NONE) { - throw new Sim_exception("You can't specify two transient conditions."); - } - trans_condition = type; - trans_entity_id = get_entity_id(entity); - trans_event_type = event_type; - initial_trans_count = count; - } - - /** - * Specify a transient condition based on the elapsed simulation time. - * @param type The transient condition type. This must be set to <code>TIME_ELAPSED</code>. - * @param time The time period after which the condition will be satisfied - */ - public static void set_transient_condition(int type, double time) { - if (type != TIME_ELAPSED) { - throw new Sim_exception("The method used must be passed a condition based on the elapsed simulation time."); - } else if (time <= 0.0) { - throw new Sim_exception("The transient time must be positive."); - } else if (trans_condition != NONE) { - throw new Sim_exception("You can't specify two transient conditions."); - } - trans_condition = type; - initial_trans_time = time; - } - - /** - * Specify an output analysis method for the simulation. The default, if this method is not used is <code>NONE</code>. - * If independent replications is selected, 10 replications will be performed. If batch means is selected, the - * observations will be batched into 10 to 20 batches. The actual number of batches used will be the one that - * gives the least serial correlation among the batch means. - * <p> - * The confidence level that will be used for calculating the simulation's measures' confidence intervals is - * <code>0.90</code> (<code>90%</code>). - * @param type The output analysis method - */ - public static void set_output_analysis(int type) { - if ((type != NONE) && (type != IND_REPLICATIONS) && (type != BATCH_MEANS)) { - throw new Sim_exception("The output analysis method must be either NONE, IND_REPLICATIONS or BATCH_MEANS."); - } else if (term_condition == INTERVAL_ACCURAC... [truncated message content] |
From: <mar...@us...> - 2007-10-04 06:04:39
|
Revision: 65 http://gridsim.svn.sourceforge.net/gridsim/?rev=65&view=rev Author: marcos_dias Date: 2007-10-03 23:04:43 -0700 (Wed, 03 Oct 2007) Log Message: ----------- This version contains many changes and bug fixes: + Some classes have been moved to gridsim.turbo package. + The ParallelSpaceShared policy has been changed substantially and some bugs have been fixed. For example, the policy was not compressing the schedule properly when cancelling a gridlet. This could also lead to finding the wrong anchor for a job when the completion of a job matched the completion of another job and there was a big job starting at this completion time. + Some advance reservation features have been provided, but they are still being tested. + Improvements in the graphical user interface have been made. + Some changes in SimJava classes have been made to remove the animation and log capabilities that are not used by GridSim. Removed Paths: ------------- branches/gridsim4.0-branch3/source/gridsim/ResourceCharacteristics.java Deleted: branches/gridsim4.0-branch3/source/gridsim/ResourceCharacteristics.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/ResourceCharacteristics.java 2007-10-04 06:03:39 UTC (rev 64) +++ branches/gridsim4.0-branch3/source/gridsim/ResourceCharacteristics.java 2007-10-04 06:04:43 UTC (rev 65) @@ -1,413 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * $Id: ResourceCharacteristics.java,v 1.1 2007/04/05 04:21:33 marcosd Exp $ - */ - -package gridsim; - -import java.util.Iterator; -import java.util.LinkedList; - -/** - * GridSim ResourceCharacteristics class represents static properties of a - * resource such as resource architecture, Operating System (OS), management - * policy (time- or space-shared), cost and time zone at which the resource - * is located along resource configuration. - * - * @author Manzur Murshed and Rajkumar Buyya - * @since GridSim Toolkit 1.0 - * @invariant $none - */ -public class ResourceCharacteristics -{ - private int id_; // resource id--setup when Resource is created - private String architecture_; - private String OS_; - private MachineList machineList_; - private double timeZone_; // difference from GMT - - // Price/CPU-unit if unit = sec., then G$/CPU-sec. - private double costPerSec_; - - // Resource Types -- allocation policy - private int allocationPolicy_; - - /** Time-shared system using Round-Robin algorithm */ - public static final int TIME_SHARED = 0; - - /** Spaced-shared system using First Come First Serve (FCFS) algorithm */ - public static final int SPACE_SHARED = 1; - - /** Assuming all PEs in all Machines have the same rating. */ - public static final int OTHER_POLICY_SAME_RATING = 2; - - /** Assuming all PEs in a Machine have the same rating. - * However, each Machine has different rating to each other. - */ - public static final int OTHER_POLICY_DIFFERENT_RATING = 3; - - /** A resource that supports Advanced Reservation mechanisms. */ - public static final int ADVANCE_RESERVATION = 4; - - /** Parallel spaced-shared system using First Come First Serve (FCFS) - * algorithm and conservative backfilling */ - public static final int PARALLEL_SPACE_SHARED = 5; - - /** - * Allocates a new ResourceCharacteristics object. - * If the time zone is invalid, then by default, it will be GMT+0. - * @param architecture the architecture of a resource - * @param OS the operating system used - * @param machineList list of machines in a resource - * @param allocationPolicy the resource allocation policy - * @param timeZone local time zone where the resource is. - * Time zone should be of range [GMT-12 ... GMT+13] - * @param costPerSec the cost per sec to use this resource - * @pre architecture != null - * @pre OS != null - * @pre machineList != null - * @pre allocationPolicy >= 0 && allocationPolicy <= 3 - * @pre timeZone >= -12 && timeZone <= 13 - * @pre costPerSec >= 0.0 - * @post $none - */ - public ResourceCharacteristics(String architecture, String OS, - MachineList machineList, int allocationPolicy, - double timeZone, double costPerSec) - { - this.id_ = -1; - this.architecture_ = architecture; - this.OS_ = OS; - this.machineList_ = machineList; - this.allocationPolicy_ = allocationPolicy; - this.costPerSec_ = costPerSec; - - if (AdvanceReservation.validateTimeZone(timeZone) == false) { - this.timeZone_ = 0.0; - } - else { - this.timeZone_ = timeZone; - } - } - - /** - * Sets the resource ID - * @param id the resource ID - * @pre id >= 0 - * @post $none - */ - public void setResourceID(int id) { - this.id_ = id; - } - - /** - * Gets the resource ID - * @return the resource ID - * @pre $none - * @post $result >= 0 - */ - public int getResourceID() { - return id_; - } - - /** - * Gets the name of a resource - * @return the resource name - * @pre $none - * @post $result != null - */ - public String getResourceName() { - return GridSim.getEntityName(id_); - } - - /** - * Gets the resource architecture name - * @return the architecture name - * @pre $none - * @post $result != null - */ - public String getResourceArch() { - return architecture_; - } - - /** - * Gets the Operating System (OS) this resource is used - * @return the name of OS - * @pre $none - * @post $result != null - */ - public String getResourceOS() { - return OS_; - } - - /** - * Gets the list of machines in a resouce - * @return a MachineList object - * @see gridsim.MachineList - * @pre $none - * @post $result != null - */ - public MachineList getMachineList() { - return machineList_; - } - - /** - * Gets a Machine with at least one empty PE - * @return a Machine object or <tt>null</tt> if not found - * @pre $none - * @post $none - */ - public Machine getMachineWithFreePE() { - return machineList_.getMachineWithFreePE(); - } - - /** - * Returns a list of machines with free PEs. - * @return the list of machines with free PEs. - */ - public LinkedList<Machine> getListMachineWithFreePE() { - return machineList_.getListMachineWithFreePE(); - } - - /** - * Gets a Machine with at least a given number of free PE - * @param numPE number of PE - * @return a Machine object or <tt>null</tt> if not found - * @pre $none - * @post $none - */ - public Machine getMachineWithFreePE(int numPE) { - return machineList_.getMachineWithFreePE(numPE); - } - - /** - * Gets the resource allocation policy - * @return the allocation policy - * @pre $none - * @post $result >= 0 && $result <= 2 - */ - public int getResourceAllocationPolicy() { - return allocationPolicy_; - } - - /** - * Gets the resource time zone - * @return the time zone - * @pre $none - * @post $none - */ - public double getResourceTimeZone() { - return timeZone_; - } - - /** - * Gets Millions Instructions Per Second (MIPS) Rating of a Processing - * Element (PE). It is assumed all PEs' rating is same in a given machine. - * @return the MIPS Rating or <tt>-1</tt> if no PEs are exists. - * @pre $none - * @post $result >= -1 - */ - public int getMIPSRatingOfOnePE() - { - if (machineList_.size() == 0) { - return -1; - } - - return machineList_.getMachine(0).getMIPSRating(0); - } - - /** - * Gets Millions Instructions Per Second (MIPS) Rating of a Processing - * Element (PE). - * It is essential to use this method when a resource is made up - * of heterogenous PEs/machines. - * @param id the machine ID - * @param peID the PE ID - * @return the MIPS Rating or <tt>-1</tt> if no PEs are exists. - * @pre id >= 0 - * @pre peID >= 0 - * @post $result >= -1 - */ - public int getMIPSRatingOfOnePE(int id, int peID) - { - if (machineList_.size() == 0) { - return -1; - } - - return machineList_.getMachine(id).getMIPSRating(peID); - } - - /** - * Gets the total MIPS rating, which is the sum of MIPS rating of all - * machines in a resource. - * <p> - * Total MIPS rating for: - * <ul> - * <li>TimeShared = 1 Rating of a PE * Total number of PEs - * <li>Other policy same rating = same as TimeShared - * <li>SpaceShared = Sum of all PEs in all Machines - * <li>Other policy different rating = same as SpaceShared - * <li>Advance Reservation = 0 or unknown. - * You need to calculate this manually. - * </ul> - * - * @return the sum of MIPS ratings - * @pre $none - * @post $result >= 0 - */ - public int getMIPSRating() - { - int rating = 0; - switch (allocationPolicy_) - { - // Assuming all PEs in all Machine have same rating. - case ResourceCharacteristics.TIME_SHARED: - case ResourceCharacteristics.OTHER_POLICY_SAME_RATING: - rating = getMIPSRatingOfOnePE() * machineList_.getNumPE(); - break; - - // Assuming all PEs in a given Machine have the same rating. - // But different machines in a Cluster can have different rating - case ResourceCharacteristics.SPACE_SHARED: - case ResourceCharacteristics.OTHER_POLICY_DIFFERENT_RATING: - Iterator it = machineList_.iterator(); - while(it.hasNext()){ - rating += ((Machine) it.next()).getMIPSRating(); - } - break; - - default: - break; - } - - return rating; - } - - /** - * Gets the CPU time given the specified parameters (only for TIME_SHARED). - * <tt>NOTE:</tt> The CPU time for SPACE_SHARED and ADVANCE_RESERVATION - * are not yet implemented. - * @param gridletLength the length of a Gridlet - * @param load the load of a Gridlet - * @return the CPU time - * @pre gridletLength >= 0.0 - * @pre load >= 0.0 - * @post $result >= 0.0 - */ - public double getCPUTime(double gridletLength, double load) - { - double cpuTime = 0.0; - - switch (allocationPolicy_) - { - case ResourceCharacteristics.TIME_SHARED: - cpuTime = gridletLength / ( getMIPSRatingOfOnePE()*(1.0-load) ); - break; - - default: - break; - } - - return cpuTime; - } - - /** - * Gets the total number of PEs for all Machines - * @return number of PEs - * @pre $none - * @post $result >= 0 - */ - public int getNumPE() { - return machineList_.getNumPE(); - } - - /** - * Gets the total number of <tt>FREE</tt> or non-busy PEs for all Machines - * @return number of PEs - * @pre $none - * @post $result >= 0 - */ - public int getNumFreePE() { - return machineList_.getNumFreePE(); - } - - /** - * Gets the total number of <tt>BUSY</tt> PEs for all Machines - * @return number of PEs - * @pre $none - * @post $result >= 0 - */ - public int getNumBusyPE() { - return machineList_.getNumBusyPE(); - } - - /** - * Sets the particular PE status on a Machine - * @param status PE status, either <tt>PE.FREE</tt> or <tt>PE.BUSY</tt> - * @param machineID Machine ID - * @param peID PE id - * @return <tt>true</tt> if the PE status has changed, <tt>false</tt> - * otherwise (Machine id or PE id might not be exist) - * @pre machineID >= 0 - * @pre peID >= 0 - * @post $none - */ - public boolean setStatusPE(boolean status, int machineID, int peID) { - return machineList_.setStatusPE(status, machineID, peID); - } - - /** - * Sets the cost per second associated with a resource - * @param costPerSec the cost using a resource - * @pre costPerSec >= 0.0 - * @post $none - */ - public void setCostPerSec(double costPerSec) { - this.costPerSec_ = costPerSec; - } - - /** - * Gets the cost per second associated with a resource - * @return the cost using a resource - * @pre $none - * @post $result >= 0.0 - */ - public double getCostPerSec() { - return costPerSec_; - } - - /** - * Gets the cost per Millions Instruction (MI) associated with a resource - * @return the cost using a resource - * @pre $none - * @post $result >= 0.0 - */ - public double getCostPerMI() { - return costPerSec_ / getMIPSRatingOfOnePE(); - } - - /** - * Gets the byte size of this class - * @return the byte size - * @pre $none - * @post $result > 0 - */ - public int getByteSize() - { - // this class overall has: 2 ints, 2 Strings, 1 MachineList and - // 2 doubles. - // NOTE: static attributes do not count - int totalInt = 2 * 4; - int totalDouble = 2 * 8; - int totalSize = architecture_.length() + OS_.length() + - machineList_.getByteSize() + totalInt + totalDouble ; - - return totalSize; - } - -} // end class - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-10-04 06:03:36
|
Revision: 64 http://gridsim.svn.sourceforge.net/gridsim/?rev=64&view=rev Author: marcos_dias Date: 2007-10-03 23:03:39 -0700 (Wed, 03 Oct 2007) Log Message: ----------- This version contains many changes and bug fixes: + Some classes have been moved to gridsim.turbo package. + The ParallelSpaceShared policy has been changed substantially and some bugs have been fixed. For example, the policy was not compressing the schedule properly when cancelling a gridlet. This could also lead to finding the wrong anchor for a job when the completion of a job matched the completion of another job and there was a big job starting at this completion time. + Some advance reservation features have been provided, but they are still being tested. + Improvements in the graphical user interface have been made. + Some changes in SimJava classes have been made to remove the animation and log capabilities that are not used by GridSim. Modified Paths: -------------- branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_event.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_port.java branches/gridsim4.0-branch3/source/gridsim/ARPolicy.java branches/gridsim4.0-branch3/source/gridsim/ARSimpleSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/GridResource.java branches/gridsim4.0-branch3/source/gridsim/GridSim.java branches/gridsim4.0-branch3/source/gridsim/GridSimTags.java branches/gridsim4.0-branch3/source/gridsim/Gridlet.java branches/gridsim4.0-branch3/source/gridsim/MachineList.java branches/gridsim4.0-branch3/source/gridsim/ResGridletList.java branches/gridsim4.0-branch3/source/gridsim/SpaceShared.java branches/gridsim4.0-branch3/source/gridsim/TimeShared.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/net/BusLink.java branches/gridsim4.0-branch3/source/gridsim/net/Output.java branches/gridsim4.0-branch3/source/gridsim/services/MessageBody.java branches/gridsim4.0-branch3/source/gridsim/services/Negotiation.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationList.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationMessage.java branches/gridsim4.0-branch3/source/gridsim/services/index/GridServiceRepository.java branches/gridsim4.0-branch3/source/gridsim/services/index/RegionalGSR.java Added Paths: ----------- branches/gridsim4.0-branch3/examples/examples/ar/ branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java branches/gridsim4.0-branch3/examples/examples/workload/ar/ branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java branches/gridsim4.0-branch3/source/gridsim/gui/ItemPanel.java branches/gridsim4.0-branch3/source/gridsim/gui/ScheduleItem.java branches/gridsim4.0-branch3/source/gridsim/turbo/ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java branches/gridsim4.0-branch3/source/gridsim/turbo/PERangeList.java branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java Removed Paths: ------------- branches/gridsim4.0-branch3/examples/examples/ar/Example10.java branches/gridsim4.0-branch3/examples/examples/ar/README.txt branches/gridsim4.0-branch3/source/eduni/simdiag/ branches/gridsim4.0-branch3/source/eduni/simjava/Sim_accum.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_reporter.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_reportfile.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_stat.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_stat_exception.java branches/gridsim4.0-branch3/source/eduni/simjava/package.html branches/gridsim4.0-branch3/source/gridsim/PERange.java branches/gridsim4.0-branch3/source/gridsim/PERangeList.java branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/gui/DetachedMagnifyingGlass.java branches/gridsim4.0-branch3/source/gridsim/gui/GridletPanel.java Copied: branches/gridsim4.0-branch3/examples/examples/ar (from rev 53, trunk/examples/Example10) Modified: branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java =================================================================== --- trunk/examples/Example10/ARTest.java 2007-09-01 02:48:15 UTC (rev 53) +++ branches/gridsim4.0-branch3/examples/examples/ar/ARTest.java 2007-10-04 06:03:39 UTC (rev 64) @@ -1,19 +1,24 @@ /* - * Author Anthony Sulistio - * Date: May 2004 + * Author Marcos Dias de Assuncao + * Date: September 2007 * Description: A simple program to demonstrate of how to use basic * advanced reservation functionalities, such as create, commit * and status. - * - * NOTE: The values used from this example are taken from the GridSim paper. - * http://www.gridbus.org/gridsim/ - * $Id: ARTest.java,v 1.3 2007/08/10 02:35:40 anthony Exp $ */ -import java.util.*; -import gridsim.*; -import eduni.simjava.*; +package examples.ar; +import gridsim.GridSim; +import gridsim.Gridlet; +import gridsim.GridletList; +import gridsim.turbo.Reservation; +import gridsim.turbo.ReservationRequester; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.Random; + /** * A user entity that reserves a resource in advance. * In this example, only explore some functionalities, such as: @@ -23,11 +28,10 @@ * - commits an accepted reservation * - checks the status of a reservation */ -public class ARTest extends AdvanceReservation -{ +public class ARTest extends ReservationRequester { private GridletList list_; // a list containing new Gridlets private GridletList receiveList_; // a list containing completed Gridlets - private int failReservation_; // number of reservations failed + private int failReservation_; // number of reservations failed // time constant values private final int SEC = 1; // 1 second @@ -40,7 +44,6 @@ * Creates a new grid user entity * @param name the Entity name of this object * @param baud_rate the communication speed - * @param timeZone user's local time zone * @param totalJob number of Gridlets to be created * @throws Exception This happens when creating this entity before * initializing GridSim package or the entity name is @@ -48,9 +51,8 @@ * @see gridsim.GridSim#init(int, Calendar, boolean) */ public ARTest(String name, double baud_rate, double timeZone, - int totalJob) throws Exception - { - super(name, baud_rate, timeZone); + int totalJob) throws Exception { + super(name, baud_rate); this.receiveList_ = new GridletList(); this.failReservation_ = 0; @@ -65,8 +67,7 @@ /** * The core method that handles communications among GridSim entities. */ - public void body() - { + public void body() { LinkedList resList; // waiting to get list of resources. Since GridSim package uses @@ -74,8 +75,7 @@ // before one or more grid resource entities manage to register // themselves to GridInformationService (GIS) entity. // Therefore, it's better to wait in the first place - while (true) - { + while (true) { // need to pause for a while to wait GridResources finish // registering to GIS super.gridSimHold(2*SEC); // wait for 2 seconds @@ -124,11 +124,10 @@ } //---------------------------------------------------- - // sends one or more reservations to a gridresource entity + // sends one or more reservations to a grid resource entity sendReservation(resARList, resNameList); - try - { + try { // then get the results or Gridlets back int size = list_.size() - failReservation_; for (i = 0; i < size; i++) @@ -154,23 +153,17 @@ * One reservation only reserves 1 PE. At the moment, GridSim is only * able to execute 1 Gridlet on a single PE. */ - private void sendReservation(ArrayList resARList, ArrayList resNameList) - { + private void sendReservation(ArrayList resARList, ArrayList resNameList) { // total reservation made. 1 reservation reserves 1 PE. - int totalPE = 1; + int totalPE = 2; int totalReservation = list_.size(); // total number of Gridlets - // gets the init simulation time - Calendar cal = GridSim.getSimulationCalendar(); - // wants to reserve 1 day after the init simulation time - int MILLI_SEC = 1000; - long time = cal.getTimeInMillis() + (1 * DAY * MILLI_SEC); + long time = 1 * DAY; // each reservation requires around 10 minutes int duration = 10 * MIN; - String result = null; Gridlet gl = null; int val = 0; int resID = 0; // a resource ID @@ -179,8 +172,7 @@ Random randObj = new Random(time); - for (int i = 0; i < totalReservation; i++) - { + for (int i = 0; i < totalReservation; i++) { duration += 5 * MIN; // duration of a reservation // gets the resource ID and name @@ -194,50 +186,38 @@ time = 0; // immediate reservation } else { - time = cal.getTimeInMillis() + (1*DAY*MILLI_SEC) - + (duration*MILLI_SEC); + time = 1 * HOUR + duration; } // creates a new or immediate reservation - result = super.createReservation(time, duration, totalPE, resID); - System.out.println(super.get_name() + ": reservation result from "+ - resName + " = " + result + " at time = " + GridSim.clock()); - - // queries the status of this reservation - val = super.queryReservation(result); - System.out.println(super.get_name() + ": query result = " + - AdvanceReservation.getQueryResult(val) ); + Reservation reservation = null; + boolean success = false; - // if a reservation fails, then continue the next Gridlet - if (val == GridSimTags.AR_STATUS_ERROR || - val == GridSimTags.AR_STATUS_ERROR_INVALID_BOOKING_ID) - { + reservation = super.createReservation(time, duration, totalPE, resID); + if(reservation != null) { + System.out.println(super.get_name() + ": reservation has been returned from "+ + resName + " at time = " + GridSim.clock()); + } + else { + System.out.println(super.get_name() + ": no reservation has been returned from "+ + resName + " at time = " + GridSim.clock()); failReservation_++; - System.out.println("=========================="); - continue; } - // for a reservation with an even number, commits straightaway - // without sending any Gridlets yet - if (i % 2 == 0) - { - val = super.commitReservation(result); - System.out.println(super.get_name() + - ": commit only with result = " + - AdvanceReservation.getCommitResult(val) ); + if(reservation != null) { + // for a reservation with an even number, commits straightaway + // without sending any Gridlets yet + success = super.commitReservation(reservation.getID()); + + if(success) { + System.out.println("Reservation # "+ reservation.getID() + + " has been committed successfully."); + } + else { + System.out.println("Reservation # "+ reservation.getID() + + " has NOT been committed successfully."); + } } - - // a reservation only needs to reserve 1 PE. - gl = (Gridlet) list_.get(i); - val = super.commitReservation(result, gl); - System.out.println(super.get_name() + ": commit result = " + - AdvanceReservation.getCommitResult(val) ); - - // queries the status of this reservation - val = super.queryReservation(result); - System.out.println(super.get_name() + ": query result = " + - AdvanceReservation.getQueryResult(val) ); - System.out.println("=========================="); } } @@ -255,16 +235,15 @@ * GridSimRandom class. * @return a GridletList object */ - private GridletList createGridlet(int size, int userID) - { + private GridletList createGridlet(int size, int userID) { // Creates a container to store Gridlets GridletList list = new GridletList(); int length = 5000; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { // creates a new Gridlet object Gridlet gridlet = new Gridlet(i, length, 1000, 5000); + // add the Gridlet into a list list.add(gridlet); gridlet.setUserID(userID); Deleted: branches/gridsim4.0-branch3/examples/examples/ar/Example10.java =================================================================== --- trunk/examples/Example10/Example10.java 2007-09-01 02:48:15 UTC (rev 53) +++ branches/gridsim4.0-branch3/examples/examples/ar/Example10.java 2007-10-04 06:03:39 UTC (rev 64) @@ -1,263 +0,0 @@ -/* - * Author Anthony Sulistio - * Date: May 2004 - * Description: A simple program to demonstrate of how to use basic - * advanced reservation functionalities, such as create, commit - * and status. - * - * NOTE: The values used from this example are taken from the GridSim paper. - * http://www.gridbus.org/gridsim/ - * $Id: Example10.java,v 1.2 2004/05/31 04:53:33 anthony Exp $ - */ - -import java.util.*; -import gridsim.*; - -/** - * This is the main class to run the example. - */ -public class Example10 -{ - /** - * A main method that initializes GridSim, creating user and grid - * resource entities before running the simulation. - */ - public static void main(String[] args) - { - System.out.println("Starting Example10"); - try - { - // First step: Initialize the GridSim package. It should be called - // before creating any entities. We can't run this example without - // initializing GridSim first. We will get run-time exception - // error. - int num_user = 5; // number of user entities - - // Gets the current time as the init simulation time. - // The time plays a very important role in determining start - // and end time of a reservation. Both start and end time must - // be greater than the init simulation time. - Calendar calendar = Calendar.getInstance(); - System.out.println("Init simulation time = " + calendar.getTime()); - - boolean trace_flag = false; // true means trace GridSim events - - // Since GridSim 3.0, there are different ways to initialize the - // GridSim package. One of them is below without the need to - // have GridStatistics entity. Therefore, removing any redundant - // entities. - GridSim.init(num_user, calendar, trace_flag); - - //------------------------------------------------ - // Second step: Creates one or more GridResource objects - // given resource name, total PE, number of Machine, time zone - // and MIPS Rating. - - // R0: vpac Compaq AlphaServer - ARGridResource resource0 = createGridResource("Resource_0", - 4, 1, 10.0, 515); - - // R1: Manjra Linux PC - ARGridResource resource1 = createGridResource("Resource_1", - 13, 1, 10.0, 684); - - // R2: Germany - ARGridResource resource2 = createGridResource("Resource_2", - 16, 1, 1.0, 410); - - // R3: Czech - ARGridResource resource3 = createGridResource("Resource_3", - 6, 1, 1.0, 410); - - // R4: Chichago - ARGridResource resource4 = createGridResource("Resource_4", - 8, 1, -6.0, 377); - - //------------------------------------------------ - // Third step: Creates grid users - ARTest[] userList = new ARTest[num_user]; - ARTest user = null; // a user entity - double bandwidth = 1000; // bandwidth of this user - double timeZone = 0.0; // user's time zone - int totalJob = 0; // total Gridlets owned - int i = 0; - - // a loop that creates a user entity - for (i = 0; i < num_user; i++) - { - // users with an even number have their time zone to GMT+8 - if (i % 2 == 0) - { - timeZone = 8.0; // with respect to GMT or UTC - totalJob = 4; - } - - // users with an odd number have their time zone to GMT-3 - else - { - timeZone = -3.0; // with respect to GMT or UTC - totalJob = 5; - } - - // creates a user entity - user = new ARTest("User_" + i, bandwidth, timeZone, totalJob); - - // put the entity into an array - userList[i] = user; - } - - //------------------------------------------------ - // Fourth step: Starts the simulation - GridSim.startGridSimulation(); - - //------------------------------------------------ - // Final step: Prints the Gridlets when this simulation is over - GridletList newList = null; - for (i = 0; i < num_user; i++) - { - user = (ARTest) userList[i]; - newList = user.getGridletList(); - printGridletList( newList, user.get_name() ); - } - - System.out.println("Finish Example10"); - } - catch (Exception e) - { - System.out.println("Error ...... EXCEPTION"); - e.printStackTrace(); - } - - } - - /** - * Creates a GridResource entity that supports advanced reservation - * functionalities. - */ - private static ARGridResource createGridResource(String name, int totalPE, - int totalMachine, double timeZone, int rating) - { - // Here are the steps needed to create a Grid resource: - // 1. We need to create an object of MachineList to store one or more - // Machines - MachineList mList = new MachineList(); - for (int i = 0; i < totalMachine; i++) - { - // 2. A Machine contains one or more PEs or CPUs. Therefore, should - // create an object of PEList to store these PEs before creating - // a Machine. - PEList peList = new PEList(); - - // 3. Create PEs and add these into an object of PEList. - for (int k = 0; k < totalPE; k++) - { - // need to store PE id and MIPS Rating - peList.add( new PE(k, rating) ); - } - - // 4. Create one Machine with its id and list of PEs or CPUs - mList.add( new Machine(i, peList) ); - } - - // 5. Create a ResourceCharacteristics object that stores the - // properties of a Grid resource: architecture, OS, list of - // Machines, allocation policy, time zone and its price - String arch = "Sun Ultra"; // system architecture - String os = "Solaris"; // operating system - double cost = 3.0; // the cost of using this resource (G$/PE) - - // NOTE: allocation policy in here is set to - // ResourceCharacteristics.ADVANCE_RESERVATION not SPACE_SHARED nor - // TIME_SHARED. - ResourceCharacteristics resConfig = new ResourceCharacteristics( - arch, os, mList, ResourceCharacteristics.ADVANCE_RESERVATION, - timeZone, cost); - - // 6. Finally, we need to create a GridResource object. - double baud_rate = 1000.0; // communication speed - long seed = 11L*13*17*19*23+1; - double peakLoad = 0.0; // the resource load during peak hour - double offPeakLoad = 0.0; // the resource load during off-peak hr - double holidayLoad = 0.0; // the resource load during holiday - - // incorporates weekends so the grid resource is on 7 days a week - LinkedList Weekends = new LinkedList(); - Weekends.add(new Integer(Calendar.SATURDAY)); - Weekends.add(new Integer(Calendar.SUNDAY)); - - // incorporates holidays. However, no holidays are set in this example - LinkedList Holidays = new LinkedList(); - ARGridResource gridRes = null; - - // creates a resource calendar that handles different loads - ResourceCalendar cal = new ResourceCalendar( - resConfig.getResourceTimeZone(), peakLoad, offPeakLoad, - holidayLoad, Weekends, Holidays, seed); - - try - { - // use this AR scheduling algorithm. The name of this entity - // will be name_scheduler, e.g. Resource0_scheduler. - String scheduler = "scheduler"; - ARSimpleSpaceShared policy =new ARSimpleSpaceShared(name,scheduler); - - // then creates a grid resource entity. - // NOTE: You need to use a grid resource entity that supports - // advanced reservation functionalities. In this case, the entity - // is called ARGridResource. - gridRes = new ARGridResource(name,baud_rate,resConfig,cal,policy); - } - catch (Exception e) { - e.printStackTrace(); - } - - System.out.println("Creates one Grid resource with name = " + name); - return gridRes; - } - - /** - * Prints the Gridlet objects - * @param list list of Gridlets - */ - private static void printGridletList(GridletList list, String name) - { - String indent = " "; - System.out.println(); - System.out.println("========== OUTPUT for " + name + " =========="); - System.out.println("Gridlet ID" + indent + "STATUS" + indent + - "Resource ID" + indent + "Cost"); - - int size = list.size(); - int i = 0; - Gridlet gridlet = null; - String status; - - // for each user entity, prints out the results. Prints out the - // table of summary - for (i = 0; i < size; i++) - { - gridlet = (Gridlet) list.get(i); - System.out.print(indent + gridlet.getGridletID() + indent - + indent); - - status = gridlet.getGridletStatusString(); - System.out.print(status); - - System.out.println( indent + indent + gridlet.getResourceID() + - indent + indent + gridlet.getProcessingCost() ); - } - - // for each Gridlet, prints out its detailed operation / report - /***** NOTE: Not recommended for many Gridlets as each Gridlet - // report is pretty long - System.out.println(); - for (i = 0; i < size; i++) - { - gridlet = (Gridlet) list.get(i); - System.out.println( gridlet.getGridletHistory() ); - } - *********/ - } - -} // end class - Deleted: branches/gridsim4.0-branch3/examples/examples/ar/README.txt =================================================================== --- trunk/examples/Example10/README.txt 2007-09-01 02:48:15 UTC (rev 53) +++ branches/gridsim4.0-branch3/examples/examples/ar/README.txt 2007-10-04 06:03:39 UTC (rev 64) @@ -1,47 +0,0 @@ - -/** - * Author: Anthony Sulistio - * Date: May 2004 - * $Id: README.txt,v 1.4 2007/08/10 02:35:23 anthony Exp $ - */ - -Welcome to the 10th Example of how to use GridSim package. -To compile the example source code: - In Unix/Linux: javac -classpath $GRIDSIM/jars/gridsim.jar:. Example10.java - In Windows: javac -classpath %GRIDSIM%\jars\gridsim.jar;. Example10.java - -where $GRIDSIM or %GRIDSIM% is the location of the gridsimtoolkit package. - - -To run the class file: - In Unix/Linux: - java -classpath $GRIDSIM/jars/gridsim.jar:. Example10 - - In Windows: - java -classpath %GRIDSIM%\jars\gridsim.jar;. Example10 - - -NOTE: This example uses Java Random class to select a resource entity to - process a Gridlet. Hence, when running this example many times, - the values are different. - - -When running the example file, it will produce the following files: - - tracefile -> created by SimJava 1.2, now being replaced by sim_trace - NOTE: GridSim 2.1 uses SimJava 1.2 package - GridSim 2.2 onwards use SimJava2 package - - sim_trace -> created by the SimJava2 package (lower-level) to trace every - events (performed by SimJava and GridSim) during the simulation. - We don't need to worry about this file. Not to important for our - example. - - sim_report -> created by the SimJava2 package (lower-level) of GridSim. - This is a simulation report that contains general information about - running this experiment. We don't need to worry about this file. - Not to important for our example. - -NOTE: When you run the program multiple times, - "sim_trace" and "sim_report" file will be overwritten. - Added: branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/ar/SimpleARExample01.java 2007-10-04 06:03:39 UTC (rev 64) @@ -0,0 +1,245 @@ +/* + * Author: Marcos Dias de Assuncao + * Date: September 2007 + * Description: A simple program to demonstrate of how to use basic + * advanced reservation functionalities, such as create, commit + * and status. + */ + +package examples.ar; + +import java.util.*; +import gridsim.*; +import gridsim.turbo.ARParallelSpaceShared; +import gridsim.turbo.ARTGridResource; +import gridsim.turbo.TResourceCharacteristics; + +/** + * This is the main class to run the example. + */ +public class SimpleARExample01 { + + /** + * A main method that initialises GridSim, creating user and grid + * resource entities before running the simulation. + */ + public static void main(String[] args) { + System.out.println("SimpleARExample01"); + try { + // First step: Initialises the GridSim package. It should be called + // before creating any entities. We can't run this example without + // initialising GridSim first. We will get run-time exception + // error. + int num_user = 1; // number of user entities + + // Gets the current time as the init simulation time. + // The time plays a very important role in determining start + // and end time of a reservation. Both start and end time must + // be greater than the init simulation time. + Calendar calendar = Calendar.getInstance(); + System.out.println("Init simulation time = " + calendar.getTime()); + + boolean trace_flag = false; // true means trace GridSim events + + // Since GridSim 3.0, there are different ways to initialize the + // GridSim package. One of them is below without the need to + // have GridStatistics entity. Therefore, removing any redundant + // entities. + GridSim.init(num_user, calendar, trace_flag); + + //------------------------------------------------ + // Second step: Creates one or more GridResource objects + // given resource name, total PE, number of Machine, time zone + // and MIPS Rating. + +// // R0: vpac Compaq AlphaServer +// ARTGridResource resource0 = +// createGridResource("Resource_0", 4, 1, 10.0, 515); + + // R1: Manjra Linux PC + ARTGridResource resource1 = + createGridResource("Resource_1", 13, 1, 10.0, 684); + +// // R2: Germany +// ARTGridResource resource2 = +// createGridResource("Resource_2", 16, 1, 1.0, 410); +// +// // R3: Czech +// ARTGridResource resource3 = +// createGridResource("Resource_3", 6, 1, 1.0, 410); +// +// // R4: Chichago +// ARTGridResource resource4 = +// createGridResource("Resource_4", 8, 1, -6.0, 377); + + //------------------------------------------------ + // Third step: Creates grid users + ARTest[] userList = new ARTest[num_user]; + ARTest user = null; // a user entity + double bandwidth = 1000; // bandwidth of this user + double timeZone = 0.0; // user's time zone + int totalJob = 0; // total Gridlets owned + int i = 0; + + // a loop that creates a user entity + for (i = 0; i < num_user; i++) { + // users with an even number have their time zone to GMT+8 + if (i % 2 == 0) { + timeZone = 8.0; // with respect to GMT or UTC + totalJob = 4; + } + + // users with an odd number have their time zone to GMT-3 + else { + timeZone = -3.0; // with respect to GMT or UTC + totalJob = 5; + } + + // creates a user entity + user = new ARTest("User_" + i, bandwidth, timeZone, totalJob); + + // put the entity into an array + userList[i] = user; + } + + //------------------------------------------------ + // Fourth step: Starts the simulation +// GridSim.startGridSimulation(); + + GridSim.startGridSimulation(true); + + //------------------------------------------------ + // Final step: Prints the Gridlets when this simulation is over + GridletList newList = null; + for (i = 0; i < num_user; i++) { + user = (ARTest) userList[i]; + newList = user.getGridletList(); + printGridletList( newList, user.get_name() ); + } + + System.out.println("Finish SimpleARExample01"); + } + catch (Exception e) { + System.out.println("Error ...... EXCEPTION"); + e.printStackTrace(); + } + + } + + /** + * Creates a GridResource entity that supports advanced reservation + * functionalities. + */ + private static ARTGridResource createGridResource(String name, int totalPE, + int totalMachine, double timeZone, int rating) { + // Here are the steps needed to create a Grid resource: + // 1. We need to create an object of MachineList to store one or more + // Machines + + MachineList mList = new MachineList(); + + for (int i = 0; i < totalMachine; i++) { + ////////////////////////////////////////// + // 4. Create one Machine with its id and list of PEs or CPUs + mList.add( new Machine(i, totalPE, rating) ); + } + + // 2. Create a TResourceCharacteristics object that stores the + // properties of a Grid resource: architecture, OS, list of + // Machines, allocation policy, time zone and its price + String arch = "Sun Ultra"; // system architecture + String os = "Solaris"; // operating system + double cost = 3.0; // the cost of using this resource (G$/PE) + + // NOTE: allocation policy in here is set to + // TResourceCharacteristics.AR_PARALLEL_SPACE_SHARED not SPACE_SHARED nor + // TIME_SHARED. + TResourceCharacteristics resConfig = new TResourceCharacteristics( + arch, os, mList, TResourceCharacteristics.AR_PARALLEL_SPACE_SHARED, + timeZone, cost); + + // 6. Finally, we need to create a GridResource object. + double baud_rate = 1000.0; // communication speed + long seed = 11L*13*17*19*23+1; + double peakLoad = 0.0; // the resource load during peak hour + double offPeakLoad = 0.0; // the resource load during off-peak hr + double holidayLoad = 0.0; // the resource load during holiday + + // incorporates weekends so the grid resource is on 7 days a week + LinkedList Weekends = new LinkedList(); + Weekends.add(new Integer(Calendar.SATURDAY)); + Weekends.add(new Integer(Calendar.SUNDAY)); + + // incorporates holidays. However, no holidays are set in this example + LinkedList Holidays = new LinkedList(); + ARTGridResource gridRes = null; + + // creates a resource calendar that handles different loads + ResourceCalendar cal = new ResourceCalendar( + resConfig.getResourceTimeZone(), peakLoad, offPeakLoad, + holidayLoad, Weekends, Holidays, seed); + + try { + // use this AR scheduling algorithm. The name of this entity + // will be name_scheduler, e.g. Resource0_scheduler. + String scheduler = "scheduler"; + ARParallelSpaceShared policy = new ARParallelSpaceShared(name, scheduler); + + // then creates a grid resource entity. + // NOTE: You need to use a grid resource entity that supports + // advanced reservation functionalities. In this case, the entity + // is called ARGridResource. + gridRes = new ARTGridResource(name,baud_rate,resConfig,cal,policy); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Creates one Grid resource with name = " + name); + return gridRes; + } + + /** + * Prints the Gridlet objects + * @param list list of Gridlets + */ + private static void printGridletList(GridletList list, String name) { + String indent = " "; + System.out.println(); + System.out.println("========== OUTPUT for " + name + " =========="); + System.out.println("Gridlet ID" + indent + "STATUS" + indent + + "Resource ID" + indent + "Cost"); + + int size = list.size(); + int i = 0; + Gridlet gridlet = null; + String status; + + // for each user entity, prints out the results. Prints out the + // table of summary + for (i = 0; i < size; i++) { + gridlet = (Gridlet) list.get(i); + System.out.print(indent + gridlet.getGridletID() + indent + + indent); + + status = gridlet.getGridletStatusString(); + System.out.print(status); + + System.out.println( indent + indent + gridlet.getResourceID() + + indent + indent + gridlet.getProcessingCost() ); + } + + // for each Gridlet, prints out its detailed operation / report + /***** NOTE: Not recommended for many Gridlets as each Gridlet + // report is pretty long + System.out.println(); + for (i = 0; i < size; i++) + { + gridlet = (Gridlet) list.get(i); + System.out.println( gridlet.getGridletHistory() ); + } + *********/ + } + +} // end class + Added: branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/workload/ar/TurboARExample01.java 2007-10-04 06:03:39 UTC (rev 64) @@ -0,0 +1,179 @@ + +package examples.workload.ar; + +import gridsim.GridResource; +import gridsim.GridSim; +import gridsim.Machine; +import gridsim.MachineList; +import gridsim.ResourceCalendar; +import gridsim.turbo.ARTGridResource; +import gridsim.turbo.TResourceCharacteristics; +import gridsim.util.Workload; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.Random; + + +/** + * Test Driver class for this example + */ +public class TurboARExample01 +{ + /** + * Creates main() to run this example + */ + public static void main(String[] args) + { + long startTime = System.currentTimeMillis(); + if(args.length == 0){ + System.out.println("Please provide the location of the workload file!"); + System.exit(1); + } + + try { + + ////////////////////////////////////////// + // Get the workload to be used The format should be: + // ASCII text, gzip or zip. + + String fileName = args[0]; + // /Users/marcosd/Documents/workspace/intergrid/workloads/sdsc_blue_2000_400.swf + + ArrayList<GridResource> resources = new ArrayList<GridResource>(); + + ////////////////////////////////////////// + // Initialize the GridSim package. It should be called + // before creating any entities. We can't run this example without + // initializing GridSim first. We will get run-time exception + // error. + + // number of grid user entities + any Workload entities. + int num_user = 1; + Calendar calendar = Calendar.getInstance(); + boolean trace_flag = false; // mean trace GridSim events + + // Initialize the GridSim package without any statistical + // functionalities. Hence, no GridSim_stat.txt file is created. + System.out.println("Initializing GridSim package"); + GridSim.init(num_user, calendar, trace_flag); + + ////////////////////////////////////////// + // Creates one or more GridResource entities + int totalResource = 1; // total number of Grid resources + int rating = 377; // rating of each PE in MIPS + int totalPE = 9; // total number of PEs for each Machine + int totalMachine = 128; // total number of Machines + int i = 0; + + String[] resArray = new String[totalResource]; + for (i = 0; i < totalResource; i++) + { + String resName = "Res_" + i; + GridResource resource = createGridResource(resName, rating, totalMachine, totalPE); + resources.add(resource); + + // add a resource name into an array + resArray[i] = resName; + } + + ////////////////////////////////////////// + // Creates one Workload trace entity. + + int resID = 0; + Random r = new Random(); + resID = r.nextInt(totalResource); + Workload workload = new Workload("Load_1", fileName, resArray[resID], rating); + + ////////////////////////////////////////// + // Starts the simulation in debug mode + GridSim.startGridSimulation(true); + + // Start the simulation in normal mode +// GridSim.startGridSimulation(); + + ////////////////////////////////////////// + // Final step: Prints the Gridlets when simulation is over + long finishTime = System.currentTimeMillis(); + System.out.println("The simulation took " + (finishTime - startTime) + " milliseconds"); + + // prints the Gridlets inside a Workload entity + // workload.printGridletList(trace_flag); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Creates one Grid resource. A Grid resource contains one or more + * Machines. Similarly, a Machine contains one or more PEs (Processing + * Elements or CPUs). + * @param name a Grid Resource name + * @param peRating rating of each PE + * @param totalMachine total number of Machines + * @param totalPE total number of PEs for each Machine + */ + private static GridResource createGridResource(String name, int peRating, + int totalMachine, int totalPE) + { + + ////////////////////////////////////////// + // Here are the steps needed to create a Grid resource: + // 1. We need to create an object of MachineList to store one or more + // Machines + MachineList mList = new MachineList(); + + for (int i = 0; i < totalMachine; i++) + { + ////////////////////////////////////////// + // 4. Create one Machine with its id and list of PEs or CPUs + mList.add( new Machine(i, totalPE, peRating) ); + } + + ////////////////////////////////////////// + // 5. Create a ResourceCharacteristics object that stores the + // properties of a Grid resource: architecture, OS, list of + // Machines, allocation policy: time- or space-shared, time zone + // and its price (G$/PE time unit). + String arch = "Sun Ultra"; // system architecture + String os = "Solaris"; // operating system + double time_zone = 0.0; // time zone this resource located + double cost = 3.0; // the cost of using this resource + + TResourceCharacteristics resConfig = new TResourceCharacteristics( + arch, os, mList, TResourceCharacteristics.AR_PARALLEL_SPACE_SHARED, + time_zone, cost); + + ////////////////////////////////////////// + // 6. Finally, we need to create a GridResource object. + double baud_rate = 10000.0; // communication speed + long seed = 11L*13*17*19*23+1; + double peakLoad = 0.0; // the resource load during peak hour + double offPeakLoad = 0.0; // the resource load during off-peak hr + double holidayLoad = 0.0; // the resource load during holiday + + // incorporates weekends so the grid resource is on 7 days a week + LinkedList weekends = new LinkedList(); + weekends.add(new Integer(Calendar.SATURDAY)); + weekends.add(new Integer(Calendar.SUNDAY)); + + // incorporates holidays. However, no holidays are set in this example + LinkedList holidays = new LinkedList(); + ResourceCalendar calendar = new ResourceCalendar(time_zone, peakLoad, + offPeakLoad, holidayLoad, weekends, holidays, seed); + + ARTGridResource gridRes = null; + try { + gridRes = new ARTGridResource(name, baud_rate, resConfig, calendar, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Creates one Grid resource with name = " + name); + return gridRes; + } +} // end class + Modified: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-09-22 22:44:03 UTC (rev 63) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-10-04 06:03:39 UTC (rev 64) @@ -5,7 +5,7 @@ import gridsim.GridSim; import gridsim.Machine; import gridsim.MachineList; -import gridsim.ResourceCharacteristics; +import gridsim.turbo.TResourceCharacteristics; import gridsim.util.Workload; import java.util.ArrayList; @@ -66,8 +66,7 @@ int i = 0; String[] resArray = new String[totalResource]; - for (i = 0; i < totalResource; i++) - { + for (i = 0; i < totalResource; i++) { String resName = "Res_" + i; GridResource resource = createGridResource(resName, rating, totalMachine, totalPE); resources.add(resource); @@ -86,10 +85,10 @@ ////////////////////////////////////////// // Starts the simulation in debug mode -// GridSim.startGridSimulation(true); + GridSim.startGridSimulation(true); // Start the simulation in normal mode - GridSim.startGridSimulation(); +// GridSim.startGridSimulation(); ////////////////////////////////////////// // Final step: Prints the Gridlets when simulation is over @@ -140,8 +139,8 @@ double time_zone = 0.0; // time zone this resource located double cost = 3.0; // the cost of using this resource - ResourceCharacteristics resConfig = new ResourceCharacteristics( - arch, os, mList, ResourceCharacteristics.PARALLEL_SPACE_SHARED, + TResourceCharacteristics resConfig = new TResourceCharacteristics( + arch, os, mList, TResourceCharacteristics.PARALLEL_SPACE_SHARED, time_zone, cost); ////////////////////////////////////////// @@ -153,17 +152,17 @@ double holidayLoad = 0.0; // the resource load during holiday // incorporates weekends so the grid resource is on 7 days a week - LinkedList Weekends = new LinkedList(); - Weekends.add(new Integer(Calendar.SATURDAY)); - Weekends.add(new Integer(Calendar.SUNDAY)); + LinkedList weekends = new LinkedList(); + weekends.add(new Integer(Calendar.SATURDAY)); + weekends.add(new Integer(Calendar.SUNDAY)); // incorporates holidays. However, no holidays are set in this example - LinkedList Holidays = new LinkedList(); + LinkedList holidays = new LinkedList(); GridResource gridRes = null; try { gridRes = new GridResource(name, baud_rate, seed, - resConfig, peakLoad, offPeakLoad, holidayLoad, Weekends, - Holidays); + resConfig, peakLoad, offPeakLoad, holidayLoad, weekends, + holidays); } catch (Exception e) { e.printStackTrace(); Modified: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java 2007-09-22 22:44:03 UTC (rev 63) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java 2007-10-04 06:03:39 UTC (rev 64) @@ -5,7 +5,7 @@ import gridsim.GridSim; import gridsim.Machine; import gridsim.MachineList; -import gridsim.ResourceCharacteristics; +import gridsim.turbo.TResourceCharacteristics; import java.util.ArrayList; import java.util.Calendar; @@ -137,8 +137,8 @@ double time_zone = 0.0; // time zone this resource located double cost = 3.0; // the cost of using this resource - ResourceCharacteristics resConfig = new ResourceCharacteristics( - arch, os, mList, ResourceCharacteristics.PARALLEL_SPACE_SHARED, + TResourceCharacteristics resConfig = new TResourceCharacteristics( + arch, os, mList, TResourceCharacteristics.PARALLEL_SPACE_SHARED, time_zone, cost); ////////////////////////////////////////// @@ -150,17 +150,17 @@ double holidayLoad = 0.0; // the resource load during holiday // incorporates weekends so the grid resource is on 7 days a week - LinkedList Weekends = new LinkedList(); - Weekends.add(new Integer(Calendar.SATURDAY)); - Weekends.add(new Integer(Calendar.SUNDAY)); + LinkedList weekends = new LinkedList(); + weekends.add(new Integer(Calendar.SATURDAY)); + weekends.add(new Integer(Calendar.SUNDAY)); // incorporates holidays. However, no holidays are set in this example - LinkedList Holidays = new LinkedList(); + LinkedList holidays = new LinkedList(); GridResource gridRes = null; try { gridRes = new GridResource(name, baud_rate, seed, - resConfig, peakLoad, offPeakLoad, holidayLoad, Weekends, - Holidays); + resConfig, peakLoad, offPeakLoad, holidayLoad, weekends, + holidays); } catch (Exception e) { e.printStackTrace(); Modified: branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java 2007-09-22 22:44:03 UTC (rev 63) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java 2007-10-04 06:03:39 UTC (rev 64) @@ -18,7 +18,7 @@ import java.util.ArrayList; /** - * This class is an extended version of @link{Workload}. This class + * This class is an extended version of {@link Workload}. This class * cancels some gridlets submitted. * * @author Marcos Dias de Assuncao @@ -33,7 +33,7 @@ private final double TIME_CANCELLATION = 0.5; /** - * Create a new @link{WorkloadWithCancellation} object <b>without</b> using + * Create a new {@link WorkloadWithCancellation} object <b>without</b> using * the network extension. This means this entity directly sends Gridlets * to a resource destination without going through a wired network. <br> * <tt>NOTE:</tt> @@ -68,7 +68,7 @@ } /** - * Create a new @link{WorkloadWithCancellation} object <b>with</b> the network extension. + * Create a new {@link WorkloadWithCancellation} object <b>with</b> the network extension. * This means this entity directly sends Gridlets to a destination resource * through a link. The link is automatically created by this constructor. * @@ -182,12 +182,12 @@ if (data != null && data instanceof Gridlet) { gl = (Gridlet) data; - if(gl.getGridletStatus() == Gridlet.FAILED) - System.out.println("Gridlet failed"); +// if(gl.getGridletStatus() == Gridlet.FAILED) +// System.out.println("Gridlet failed"); +// +// if(gl.getGridletStatus() == Gridlet.CANCELED) +// System.out.println("Gridlet cancelled"); - if(gl.getGridletStatus() == Gridlet.CANCELED) - System.out.println("Gridlet cancelled"); - list_.add(gl); counter++; } Deleted: branches/gridsim4.0-branch3/source/eduni/simjava/Sim_accum.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Sim_accum.java 2007-09-22 22:44:03 UTC (rev 63) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Sim_accum.java 2007-10-04 06:03:39 UTC (rev 64) @@ -1,134 +0,0 @@ -/* Sim_accum.java */ - -package eduni.simjava; - -import java.util.ArrayList; -import java.util.List; - -/** - * A class for collecting basic statistical data during simulations. - * <p> - * This class can be used to manually calculate measurements of - * interest for state-based, non-continuous measures (see the - * <a href="http://www.dcs.ed.ac.uk/home/simjava/tutorial/index.html#6">SimJava Tutorial</a> for details). - * This is a primitive class that is still present in the API for compatibility with existing - * simulations. Simulations written with the SimJava version 2.0 should make use of <code>Sim_stat</code> - * instances for their entities if statistics are required. - * @see eduni.simjava.Sim_stat - * @version 1.0, 4 September 1996 - * @version 1.1, 29 May 1997 fwh corrected update() bug. - * @author Ross McNab - */ -public class Sim_accum { - private List intervals; - private List values; - - /** - * Allocate a new instance of the class. - */ - public Sim_accum() { - intervals = new ArrayList(); - values = new ArrayList(); - } - - /** - * Allocate a new, named, instance of the class. The name is - * supplied for <code>SIM++</code> compatibility. - * @param name The name to be associated with the instance (currently ignored) - */ - public Sim_accum(String name) { // For SIM++ compatibility - new Sim_accum(); - } - - /** - * Add a new record to the statistics collected so far. - * @param interval How long the value was held - * @param value The value to record - */ - public void update(double interval, double value) { - intervals.add(new Double(interval)); - values.add(new Double(value)); - } - - /** - * Find the minimum value recorded so far - * @return The minimum value recorded so far or 0.0 if no values have been recorded - */ - public double min(){ - double ret, val; - if (intervals.size() == 0) - ret = 0.0; - else { - ret = ((Double)values.get(0)).doubleValue(); - int values_size = values.size(); - for (int i=0; i < values_size; i++) { - val = ((Double)values.get(i)).doubleValue(); - if (val<ret) ret = val; - } - } - return ret; - } - - - /** - * Find the maximum value recorded so far - * @return The maximum value recorded so far or 0.0 if no values have been recorded - */ - public double max() { - double ret, val; - if (intervals.size() == 0) - ret = 0.0; - else { - ret = ((Double)values.get(0)).doubleValue(); - int values_size = values.size(); - for (int i=0; i < values_size; i++) { - val = ((Double)values.get(i)).doubleValue(); - if (val>ret) ret = val; - } - } - return ret; - } - - /** - * Calculates the average value held over the total - * interval recorded. - * i.e. <code>Sum_for_all_i(value[i]*interval[i])/total_interval</code> - * @return The average value - */ - public double avg() { - double ret, val, inter; - if (intervals.size() == 0) - ret = 0.0; - else { - ret = 0.0; - int intervals_size = intervals.size(); - for (int i=0; i < intervals_size; i++) { - val = ((Double)values.get(i)).doubleValue(); - inter = ((Double)intervals.get(i)).doubleValue(); - ret += val * inter; - } - ret = ret / interval_sum(); - } - return ret; - } - - /** - * Sums all the intervals recorded so far. - * @return The sum of the intervals - */ - public double interval_sum() { - double ret, val; - if (intervals.size() == 0) - ret = 0.0; - else { - ret = 0.0; - int intervals_size = intervals.size(); - for (int i=0; i < intervals_size; i++) { - val = ((Double)intervals.get(i)).doubleValue(); - ret += val; - } - } - return ret; - } -} - Modified: branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java 2007-09-22 22:44:03 UTC (rev 63) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java 2007-10-04 06:03:39 UTC (rev 64) @@ -14,8 +14,6 @@ * behaviour. Methods beginning with the prefix <code>sim_</code> are runtime * methods to be called within <code>body()</code>. * <p> - * Since version 2.0, entities don't need to check transient or termination - * conditions. These are all maintained and checked by <code>Sim_system</code>. * To check whether the termination condition has been satisfied, entities * should use the <code>Sim_system.running()</code> method. As such. entities * that exhibit a continuous, looping behaviour should have a <code>body()</code> @@ -54,79 +52,12 @@ * when the entity is considered to be busy processing. * </ul> * <p> - * In order to collect statistical measurements from entities a <code>Sim_stat</code> object needs - * to be defined for the entity. This is the object in charge of collecting observations and - * calculating measurements. Measures of interest could be default of custom. Default measures are - * those which can be considered in most simulations and whose update can be automatically carried - * out without user effort. Custom measures on the other hand... [truncated message content] |
From: <mar...@us...> - 2007-09-22 22:44:02
|
Revision: 63 http://gridsim.svn.sourceforge.net/gridsim/?rev=63&view=rev Author: marcos_dias Date: 2007-09-22 15:44:03 -0700 (Sat, 22 Sep 2007) Log Message: ----------- Bug fix (bug number 1800046): Size of a reply to a query for free/busy times Modified Paths: -------------- trunk/source/gridsim/ARPolicy.java Modified: trunk/source/gridsim/ARPolicy.java =================================================================== --- trunk/source/gridsim/ARPolicy.java 2007-09-19 01:32:28 UTC (rev 62) +++ trunk/source/gridsim/ARPolicy.java 2007-09-22 22:44:03 UTC (rev 63) @@ -453,7 +453,7 @@ // for query, just send the result list super.sim_schedule(super.outputPort_,0,GridSimTags.RETURN_AR_QUERY_TIME, - new IO_data(array, SIZE, destID) ); + new IO_data(array, size, destID) ); } // only convert the start time (result[0]) from local/resource time to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-09-19 01:32:25
|
Revision: 62 http://gridsim.svn.sourceforge.net/gridsim/?rev=62&view=rev Author: marcos_dias Date: 2007-09-18 18:32:28 -0700 (Tue, 18 Sep 2007) Log Message: ----------- Small changes in comments have been made to make it easier to understand the resource allocation policy. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java Modified: branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java 2007-09-18 04:17:27 UTC (rev 61) +++ branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java 2007-09-19 01:32:28 UTC (rev 62) @@ -12,13 +12,10 @@ import eduni.simjava.Sim_system; import gridsim.gui.AllocationAction; import gridsim.gui.AllocationListener; -//import examples.workload.parallel.Visualizer; import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; @@ -40,7 +37,7 @@ * <b>LIMITATIONS:</b><br> * <ul> * <li> The list of machines comprising this resource must be homogeneous. - * <li> Local load is not considered. If would like to simulate this, you have to + * <li> Local load is not considered. If you would like to simulate this, you have to * model the local load as gridlets. It is more precise and faster. * <li> Gridlets cannot be paused nor migrated. * </ul> @@ -57,17 +54,17 @@ public class ParallelSpaceShared extends AllocPolicy { - private LinkedList<SSGridlet> queuedGridlets_; // Queue of waiting Gridlets - private LinkedList<SSGridlet> runningGridlets_; // Queue of running Gridlets - private int numPE_; // The total number of PEs in the resource - private int ratingPE_; // The rating of one PE - private AvailabilityProfile availProfile_; // a list containing the availability of PEs - private PERangeList freePERanges_; // the ranges of available PEs + private LinkedList<SSGridlet> queuedGridlets_; // Queue of waiting Gridlets + private LinkedList<SSGridlet> runningGridlets_; // Queue of running Gridlets + private int numPE_; // The total number of PEs in the resource + private int ratingPE_; // The rating of one PE + private AvailabilityProfile availProfile_; // a list containing the availability of PEs + private PERangeList freePERanges_; // the ranges of currently available PEs - // FOR DEBUGGING PURPOSES ONLY... - private ArrayList<AllocationListener> listeners_; // the listeners interested in this policy - private boolean hasListener_; // indicates whether there are listeners registered - private double lastActionTime_; // Keep the time of last relevant allocation action + // FOR DEBUGGING PURPOSES ONLY + private ArrayList<AllocationListener> listeners_; // the listeners interested in this policy + private boolean hasListener_; // indicates whether there are listeners registered + private double lastActionTime_; // Keep the time of the last allocation action /** * Allocates a new @link{ParallelSpaceShared} object @@ -83,7 +80,6 @@ * No PEs, which means that the Gridlets cannot be processed. * A GridResource must contain one or more Machines. * A Machine must contain one or more PEs. - * <li> The machines that are part of this resource are not homogeneous. * </ul> * @see gridsim.GridSim#init(int, Calendar, boolean, * String[], String[], String) @@ -149,9 +145,9 @@ /** * Schedules a new @link{Gridlet} received by the GridResource entity. - * @param gridletl a Gridlet object to be executed + * @param gridlet a Gridlet object to be executed * @param ack an acknowledgement, i.e. <tt>true</tt> if the user wants to know - * whether this operation is success or not, <tt>false</tt> otherwise. + * whether this operation is successful or not, <tt>false</tt> otherwise. */ public void gridletSubmit(Gridlet gridlet, boolean ack) { int reqPE = gridlet.getNumPE(); @@ -265,7 +261,7 @@ * This method will search the running and waiting queues. * The User ID is important as many users might have the same * Gridlet ID in the lists. If a Gridlet is cancelled, the availability - * profile is shifted forward. This process ensures that the Gridlets + * profile is shifted forwards. This process ensures that the Gridlets * will not have an expected completion time worse than the one * initially stipulated for the Gridlet. This process if known * as the compression of the schedule. For more details please look @@ -281,11 +277,11 @@ * execute again since this method will pass the Gridlet back to * sender, i.e. the <tt>userId</tt>. * - * <li> If a Gridlet cannot be found in both execution and paused list, + * <li> If a Gridlet cannot be found in either execution and paused list, * then a <tt>null</tt> Gridlet will be send back to sender, * i.e. the <tt>userId</tt>. * - * <li> Once a Gridlet is cancelled, the availability profile is swept + * <li> Once a Gridlet is cancelled, the availability profile is scanned * and Gridlets are moved forwards. The entries in the profile incurred * by each Gridlet are updated and the new anchor for the Gridlet is found * again. This process is repeated for each Gridlet. This guarantees that @@ -315,8 +311,8 @@ // if the Gridlet's finish time is smaller than the current // time or the status is FINISHED, it means that the Gridlet - // has finished and will be but has not been removed from - // the running queue yet. It will probably be done shortly, + // has finished, but has not been removed from the running + // queue yet. It will probably be done shortly, // so just send a null to the user. if(sgl.getGridletStatus() == Gridlet.SUCCESS || sgl.getGridletFinishTime() <= currentTime){ @@ -368,7 +364,7 @@ ////////////////////////// USED FOR DEBUGGING PURPOSES ONLY /////////////////////// if(GridSim.DEBUG_SIMULATION){ - // If a gridlet has been cancelled, then inform the listeners about it + // Inform the listeners about the new schedule this.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true, lastActionTime_, null); } @@ -383,7 +379,7 @@ /** * Update the information about the jobs scheduled - * @param rgl the resource gridlet + * @param sgl the resource gridlet */ private void findAnchorPoint(SSGridlet sgl){ int reqPE = sgl.getNumPE(); @@ -392,11 +388,12 @@ double executionTime = forecastExecutionTime(ratingPE_, sgl.getRemainingGridletLength()); lastActionTime_ = GridSim.clock(); // keep the time of the last allocation action - double startTime = -1; // keeps the potential start time of the gridlet - double finishTime = -1; // stores the gridlet's expected finish time - int anchorIndex = -1; // the anchor index, the entry in the profile where the gridlet will be placed - int tailIndex = -1; // insert index represents the position in the profile where - // the entry corresponding to the gridlet's finish time will be placed + double startTime = -1; // keep the potential start time of the gridlet + double finishTime = -1; // store the gridlet's expected finish time + int anchorIndex = -1; // the anchor index, the entry in the profile where the gridlet will be placed + int tailIndex = -1; // insert index represents the position after which the entry + // corresponding to the gridlet's finish time will be placed + ProfileEntry tailEntry = null; // a pointer to the last entry analysed while scanning the profile ProfileEntry anchorEntry = null; // a pointer to the anchor entry @@ -411,8 +408,8 @@ tailEntry = entry; startTime = entry.getTime(); // sets the start time as the time of the entry - finishTime = startTime + executionTime; // calculates when the finish time would be if - // the gridlet is put in this position + finishTime = startTime + executionTime; // calculates when the finish time will be if + // the gridlet is put at this position // scan the profile until an entry with enough PEs is found if(entry.getNumPE() < reqPE) { @@ -426,7 +423,7 @@ // Look for the intersection of available ranges from // the anchor until the end of the profile or until - // the entries and further than the expected completion time + // the entries are further than the expected completion time for(int i=anchorIndex+1; i<length; i++){ ProfileEntry nextEntry = availProfile_.get(i); if(nextEntry.getTime() > finishTime){ @@ -450,17 +447,17 @@ } // Increase the number of gridlets that rely on the anchor point to - // either mark their termination time or anchor + // either mark their termination time or start time anchorEntry.increaseGridlet(); anchorIndex = availProfile_.indexOf(anchorEntry); tailIndex = availProfile_.indexOf(tailEntry); - // Selects a range to be used by the Gridlet + // Selects a list of ranges to be used by the Gridlet PERangeList selected = selectPERangeList(reqPE, intersectList); - // If the time of the last entry analysed is equals to the Gridlet - // expected finish time, then a new entry is not needed. + // If the time of the last entry analysed is smaller than the Gridlet + // expected finish time, then a new entry is needed. if(tailEntry.getTime() < finishTime){ // Creates a new entry to be added to the profile ProfileEntry newEntry = new ProfileEntry(finishTime); @@ -473,7 +470,7 @@ tailEntry.increaseGridlet(); } - // updates the entries between anchor and tail + // update the entries from anchor to (tail OR tail-1) for(int index=anchorIndex; index<=tailIndex; index++){ ProfileEntry entry = availProfile_.get(index); if(entry.getTime() == finishTime){ @@ -483,23 +480,22 @@ entry.setPERangeList(updList); } - // Sets the list of ranges used by the gridlet + // Set the list of ranges used by the gridlet sgl.setPERangeList(selected); // change Gridlet status sgl.setGridletStatus(Gridlet.QUEUED); - sgl.setGridletPotentialStartTime(startTime); sgl.setFinishTime(finishTime); } /** - * Allocates a Gridlet into free PEs and sets the Gridlet status into - * INEXEC and PE status into busy afterwards - * @param sgl a ResGridlet object - * @return <tt>true</tt> if there is an empty PE to process this Gridlet, + * Allocates a Gridlet into free PEs, sets the Gridlet status to INEXEC, + * updates the availability profile and the ranges currently available + * @param sgl a SSGridlet object + * @return <tt>true</tt> if there is are free PE to process this Gridlet, * <tt>false</tt> otherwise - * @pre rgl != null + * @pre sgl != null * @post $none */ private boolean scheduleGridletImmediately(SSGridlet sgl) { @@ -515,15 +511,15 @@ lastActionTime_ = currentTime; // keep the time of the last allocation action // freePERanges_ does not need to be clonned here as the - // PERangeList.intersection() method will create a new list of ranges - // with the intersection anyway + // PERangeList.intersection() and selectPERangeList() methods will + // create a new list of ranges with the intersection anyway PERangeList intersectList = freePERanges_; ProfileEntry closeGrlTail = null; int insertIndex = -1; // this denotes where the new entry (if needed) will be added // scan the availability profile until the expected termination - // of the Gridlet to check whether enough resources will be available - // for the Gridlet. Stop the search if not enough resources are available + // of the Gridlet to check whether enough PEs will be available + // for the Gridlet. Stop the search if not enough PEs are available for(ProfileEntry entry : availProfile_){ double entryTime = entry.getTime(); if(entryTime < currentTime) { @@ -546,7 +542,7 @@ return false; } - // increment the index. That is, last entry before finish time + 1 + // increment the index. That is, (last entry before finish time + 1) insertIndex++; // Select a list of ranges to be used by the Gridlet @@ -555,7 +551,7 @@ return false; } - // Gathers the information should be added in the insertIndex + // Gathers the information that must be added at insertIndex PERangeList listCloseGrlTail = null; if(closeGrlTail == null){ listCloseGrlTail = freePERanges_.clone(); @@ -564,15 +560,15 @@ listCloseGrlTail = closeGrlTail.getPERanges().clone(); } - // if the time of the entry at insertIndex - 1 is equals to + // if the time of the entry at (insertIndex-1) is equals to // the gridlet finish time, then a new entry in the profile - // is not needed. In this case, the entry at insertIndex - 1 + // is not needed. In this case, the entry at (insertIndex-1) // is updated to show that one more gridlet relies on the entry // to represent its completion time. This reduces the number of // entries in the availability profile boolean addNewEntry = true; - // Updates entries in the profile + // Update entries in the profile for(int index=0; index<insertIndex; index++){ ProfileEntry entry = availProfile_.get(index); if(entry.getTime() < currentTime){ @@ -589,10 +585,10 @@ entry.setPERangeList(uptList); } - // subtracts the selected ranges from the free ranges + // subtract the selected ranges from the currently free ranges freePERanges_ = PERangeList.difference(freePERanges_, selected); - // If a new entry is required, then add it. + // If a new entry is required, then add it to the profile if(addNewEntry){ // Creates a new entry to be added to the profile ProfileEntry newEntry = new ProfileEntry(finishTime); @@ -611,24 +607,25 @@ // Sets the list of ranges used by the gridlet sgl.setPERangeList(selected); - // then send this into itself + // then send this event to itself to update the queues after + // this gridlet's completion time int roundUpTime = (int)(executionTime + 1); super.sendInternalEvent(roundUpTime); return true; } /** - * This method is called to update the schedule. It verifies - * whether there are gridlets in the waiting list that should - * start execution. It also removes old entries from the - * availability profile. + * This method is called to update the schedule. It removes completed + * gridlets and return them to the users and verifies whether there are + * gridlets in the waiting list that should start execution. It also + * removes old entries from the availability profile. */ private void updateSchedule(){ double currentTime = GridSim.clock(); lastActionTime_ = currentTime; - // removes all Gridlets that have already completed from + // remove all Gridlets that have already completed from // the queue of running Gridlets PERangeList releasedRanges = new PERangeList(); LinkedList<SSGridlet> grlsCompleted = new LinkedList<SSGridlet>(); @@ -644,12 +641,12 @@ } } - if(freePERanges_ == null) + if(freePERanges_ == null) // freePERanges_ can be null if all ranges are busy freePERanges_ = new PERangeList(); freePERanges_.addAll(releasedRanges); freePERanges_.mergePERanges(); - // Updates the usage profile + // Update the availability profile LinkedList<ProfileEntry> entToRemove = new LinkedList<ProfileEntry>(); for(ProfileEntry entry : availProfile_){ if(entry.getTime() <= currentTime){ @@ -713,8 +710,8 @@ } /** - * Selects a range to be used by a Gridlet based on - * the list of free ranges. + * Selects a range to be used by a Gridlet out of the list + * of free ranges provided. * @param reqPE the number of PEs required. * @param rangeList the list of free ranges. * @return the range to be allocated or <tt>null</tt> if no @@ -853,7 +850,7 @@ * a the given Gridlet. * @param wasRunning indicates whether the gridlet was running. * <tt>true</tt> indicates that it was running and <tt>false</tt> otherwise. - * @param sgl the Gridlet whose entries have to be removed and updated + * @param sgl the Gridlet whose entries have to be removed or updated */ private void updateGridletEntriesAtProfile(boolean wasRunning, SSGridlet sgl){ @@ -869,9 +866,10 @@ // if the Gridlet was running, then update the range of PEs currently // available and set the reference time as current simulation time if(wasRunning) { - // returns the ranges to the list of free ranges - // sorts it, and consolidates the ranges to avoid fragments - // As freePERanges_, make sure that it is not null before adds the ranges back to it + // returns the ranges to the list of free ranges and consolidates + // the ranges to avoid fragments. As freePERanges_ can be null if + // all ranges are busy, make sure that it is not null before adding + // the ranges back to it if(freePERanges_ == null) freePERanges_ = new PERangeList(); @@ -903,6 +901,9 @@ } break; } + // if the entry is the gridlet's anchor point, then decrease the number of gridlets + // that rely on this entry to either mark their start time or completion time. If the + // number of Gridlets is 0 then, the entry is removed from the profile if(entryTime == startTime) { entry.decreaseGridlet(); if(entry.getNumGridlets() == 0){ @@ -911,9 +912,9 @@ } } // returns the ranges to the list of free ranges in the entry, - // sorts it, and consolidates the ranges to avoid fragments + // and consolidates the ranges to avoid fragments // As the list may be null, make sure that the list will not be - // null or empty so the released ranges can be added back to it + // null so the released ranges can be added back to it PERangeList listEntry = entry.getPERanges(); if(listEntry == null){ listEntry = new PERangeList(); @@ -928,9 +929,9 @@ /** * This method performs the compression of the schedule and availability profile. - * That means that the Gridlet is removed from the queue and the entries in the profile - * are then updated. Once the gridlet is removed, the method remove a Gridlet from - * the queue, updates the entries and then tries to reinsert the gridlet in the queue. + * That means that the Gridlet is removed from the queue and its entries in the profile + * are then updated. Once the gridlet is removed, the method selects a Gridlet from + * the queue, updates the entries and then tries to reinsert the gridlet in the profile. * In the worst case, the Gridlet will be put back in the same place.<br> * <b>NOTE:</b> * <ul> @@ -974,7 +975,8 @@ updateGridletEntriesAtProfile(false, queuedSgl); - // Now try to either schedule or reinsert the gridlet in the waiting queue + // Now try to either schedule the gridlet immediately or + // find the new anchor point boolean success = false; if(wasRunning){ success = scheduleGridletImmediately(queuedSgl); @@ -1069,8 +1071,8 @@ } /** - * This class represents an entry in the usage profile. There is an entry - * in the usage profile for each job scheduled by this policy. + * This class represents an entry in the usage profile. There is an entry + * at most in the usage profile for each job scheduled by this policy. * * @author Marcos Dias de Assuncao * @since GridSim Turbo Alpha 0.1 @@ -1108,7 +1110,7 @@ /** * Clears the list of PE ranges */ - public void clearPERange(){ + public void clearPERangeList(){ ranges_.clear(); } @@ -1179,7 +1181,6 @@ * @since GridSim Turbo Alpha 0.1 */ class AvailabilityProfile extends LinkedList<ProfileEntry>{ - private OrderProfileByTimeAsc comparatorProfile_; // To order the profile in order of time private static final long serialVersionUID = -1853610061073508770L; @@ -1188,19 +1189,11 @@ */ public AvailabilityProfile(){ super(); - comparatorProfile_ = new OrderProfileByTimeAsc(); } /** - * Sorts the availability profile by event times. - */ - public void sortAvailabilityProfile(){ - Collections.sort(this, comparatorProfile_); - } - - /** * Returns a clone of this object.<br> - * Note that this method does not clone the entries + * <b>NOTE:</b> this method does not clone the entries * @return the cloned object */ public AvailabilityProfile clone(){ @@ -1225,42 +1218,4 @@ } } - - /** - * Orders the usage profile by time - * - * @author Marcos Dias de Assuncao - * @since GridSim Turbo Alpha 0.1 - */ - class OrderProfileByTimeAsc implements Comparator<ProfileEntry>{ - - /** - * Creates a new @{link OrderProfileByTimeAsc} object. - */ - public OrderProfileByTimeAsc(){ - super(); - } - - /* - * (non-Javadoc) - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(ProfileEntry entrya, ProfileEntry entryb){ - if (entrya == null && entryb == null) { - return -1; - } else if (entryb == null) { - return 1; - } else if (entrya == null) { - return 0; - } else { - - // obtain the time corresponding time of the events - Double timea = entrya.getTime(); - Double timeb = entryb.getTime(); - - return timea.compareTo(timeb); - - } // end else - } - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-09-18 04:17:23
|
Revision: 61 http://gridsim.svn.sourceforge.net/gridsim/?rev=61&view=rev Author: marcos_dias Date: 2007-09-17 21:17:27 -0700 (Mon, 17 Sep 2007) Log Message: ----------- SOME OPTIMISATIONS AND BUG FIXES: + gridlets now share entries in the availability profile. This reduces the number of entries in the profile, improves simulation speed and minimises the use of memory. + cancellation of gridlets. Gridlets can now be cancelled and the remaining part of the queue is compressed. The compression of the queue is described in an IEEE Transactions paper described in the header of the class. The compression avoids reschedule and is faster as the first time estimation is always respected as the gridlets are considered according to the order that they were put in the queue. + Some changes in the availability, GUI, and PE ranges related classes. + One example of cancellation has been included. LIMITATIONS/KNOWN ISSUES: + AllocPolicy does not set the status of the Gridlet to CANCELED when it is sent to the user. + In fact, I do not know why the Gridlet is sent back to the user when it is cancelled. + TThe interface does not show the cancelled Gridlets properly YET. When ready, the cancelled Gridlets will appear in red right before they disappear from the panel. Modified Paths: -------------- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java branches/gridsim4.0-branch3/source/gridsim/ARPolicy.java branches/gridsim4.0-branch3/source/gridsim/GridSim.java branches/gridsim4.0-branch3/source/gridsim/PERangeList.java branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/util/Workload.java Added Paths: ----------- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java Modified: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-09-14 23:23:03 UTC (rev 60) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-09-18 04:17:27 UTC (rev 61) @@ -86,10 +86,10 @@ ////////////////////////////////////////// // Starts the simulation in debug mode - GridSim.startGridSimulation(true); +// GridSim.startGridSimulation(true); // Start the simulation in normal mode -// GridSim.startGridSimulation(); + GridSim.startGridSimulation(); ////////////////////////////////////////// // Final step: Prints the Gridlets when simulation is over Added: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExampleWithCancellation01.java 2007-09-18 04:17:27 UTC (rev 61) @@ -0,0 +1,173 @@ + +package examples.workload.parallel; + +import gridsim.GridResource; +import gridsim.GridSim; +import gridsim.Machine; +import gridsim.MachineList; +import gridsim.ResourceCharacteristics; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.Random; + + +/** + * Test Driver class for this example + */ +public class TurboExampleWithCancellation01 +{ + /** + * Creates main() to run this example + */ + public static void main(String[] args) + { + long startTime = System.currentTimeMillis(); + if(args.length == 0){ + System.out.println("Please provide the location of the workload file!"); + System.exit(1); + } + + try { + + ////////////////////////////////////////// + // Get the workload to be used The format should be: + // ASCII text, gzip or zip. + + String fileName = args[0]; + // /Users/marcosd/Documents/workspace/intergrid/workloads/sdsc_blue_2000_400.swf + + ArrayList<GridResource> resources = new ArrayList<GridResource>(); + + ////////////////////////////////////////// + // Initialise the GridSim package. It should be called + // before creating any entities. We can't run this example without + // initialising GridSim first. We will get run-time exception + // error. + + // number of grid user entities + any Workload entities. + int num_user = 1; + Calendar calendar = Calendar.getInstance(); + boolean trace_flag = false; // mean trace GridSim events + + // Initialise the GridSim package without any statistical + // functionalities. Hence, no GridSim_stat.txt file is created. + System.out.println("Initializing GridSim package"); + GridSim.init(num_user, calendar, trace_flag); + + ////////////////////////////////////////// + // Creates one or more GridResource entities + int totalResource = 1; // total number of Grid resources + int rating = 377; // rating of each PE in MIPS + int totalPE = 9; // total number of PEs for each Machine + int totalMachine = 128; // total number of Machines + int i = 0; + + String[] resArray = new String[totalResource]; + for (i = 0; i < totalResource; i++) + { + String resName = "Res_" + i; + GridResource resource = createGridResource(resName, rating, totalMachine, totalPE); + resources.add(resource); + + // add a resource name into an array + resArray[i] = resName; + } + + ////////////////////////////////////////// + // Creates one Workload trace entity. + int resID = 0; + Random r = new Random(); + resID = r.nextInt(totalResource); + WorkloadWithCancellation workload = new WorkloadWithCancellation("Load_1", fileName, resArray[resID], rating); + + ////////////////////////////////////////// + // Starts the simulation in debug mode + GridSim.startGridSimulation(true); + + // Start the simulation in normal mode +// GridSim.startGridSimulation(); + + ////////////////////////////////////////// + // Final step: Prints the Gridlets when simulation is over + long finishTime = System.currentTimeMillis(); + System.out.println("The simulation took " + (finishTime - startTime) + " milliseconds"); + + // prints the Gridlets inside a Workload entity + // workload.printGridletList(trace_flag); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Creates one Grid resource. A Grid resource contains one or more + * Machines. Similarly, a Machine contains one or more PEs (Processing + * Elements or CPUs). + * @param name a Grid Resource name + * @param peRating rating of each PE + * @param totalMachine total number of Machines + * @param totalPE total number of PEs for each Machine + */ + private static GridResource createGridResource(String name, int peRating, + int totalMachine, int totalPE) { + + ////////////////////////////////////////// + // Here are the steps needed to create a Grid resource: + // 1. We need to create an object of MachineList to store one or more + // Machines + MachineList mList = new MachineList(); + + for (int i = 0; i < totalMachine; i++) + { + ////////////////////////////////////////// + // 4. Create one Machine with its id and list of PEs or CPUs + mList.add( new Machine(i, totalPE, peRating) ); + } + + ////////////////////////////////////////// + // 5. Create a ResourceCharacteristics object that stores the + // properties of a Grid resource: architecture, OS, list of + // Machines, allocation policy: time- or space-shared, time zone + // and its price (G$/PE time unit). + String arch = "Sun Ultra"; // system architecture + String os = "Solaris"; // operating system + double time_zone = 0.0; // time zone this resource located + double cost = 3.0; // the cost of using this resource + + ResourceCharacteristics resConfig = new ResourceCharacteristics( + arch, os, mList, ResourceCharacteristics.PARALLEL_SPACE_SHARED, + time_zone, cost); + + ////////////////////////////////////////// + // 6. Finally, we need to create a GridResource object. + double baud_rate = 10000.0; // communication speed + long seed = 11L*13*17*19*23+1; + double peakLoad = 0.0; // the resource load during peak hour + double offPeakLoad = 0.0; // the resource load during off-peak hr + double holidayLoad = 0.0; // the resource load during holiday + + // incorporates weekends so the grid resource is on 7 days a week + LinkedList Weekends = new LinkedList(); + Weekends.add(new Integer(Calendar.SATURDAY)); + Weekends.add(new Integer(Calendar.SUNDAY)); + + // incorporates holidays. However, no holidays are set in this example + LinkedList Holidays = new LinkedList(); + GridResource gridRes = null; + try { + gridRes = new GridResource(name, baud_rate, seed, + resConfig, peakLoad, offPeakLoad, holidayLoad, Weekends, + Holidays); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Creates one Grid resource with name = " + name); + return gridRes; + } +} // end class + Added: branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/WorkloadWithCancellation.java 2007-09-18 04:17:27 UTC (rev 61) @@ -0,0 +1,250 @@ +/* Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + */ + +package examples.workload.parallel; + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_system; +import gridsim.GridSimTags; +import gridsim.Gridlet; +import gridsim.IO_data; +import gridsim.ParameterException; +import gridsim.net.Link; +import gridsim.util.Workload; + +import java.util.ArrayList; + +/** + * This class is an extended version of @link{Workload}. This class + * cancels some gridlets submitted. + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see Workload + */ +public class WorkloadWithCancellation extends Workload { + private final int NUM_GRIDLETS_BETWEEN_CANCELLATIONS = 50; + // value of 1, means that the cancellation will be sent + // at the gridlet's submission time + (gridlet duration * 1) + private final double TIME_CANCELLATION = 0.5; + + /** + * Create a new @link{WorkloadWithCancellation} object <b>without</b> using + * the network extension. This means this entity directly sends Gridlets + * to a resource destination without going through a wired network. <br> + * <tt>NOTE:</tt> + * You can not use this constructor in an experiment that uses a wired + * network topology. + * + * @param name this entity name + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithCancellation(String name, String fileName, String resourceName, + int rating) throws ParameterException, Exception { + + super(name, fileName, resourceName, rating); + } + + /** + * Create a new @link{WorkloadWithCancellation} object <b>with</b> the network extension. + * This means this entity directly sends Gridlets to a destination resource + * through a link. The link is automatically created by this constructor. + * + * @param name this entity name + * @param baudRate baud rate of this link (bits/s) + * @param propDelay Propagation delay of the Link in milliseconds + * @param MTU Maximum Transmission Unit of the Link in bytes. + * Packets which are larger than the MTU should be split + * up into MTU size units. + * For example, a 1024 byte packet trying to cross a 576 + * byte MTU link should get split into 2 packets of 576 + * bytes and 448 bytes. + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li> baudRate <= 0 + * <li> propDelay <= 0 + * <li> MTU <= 0 + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre baudRate > 0 + * @pre propDelay > 0 + * @pre MTU > 0 + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithCancellation(String name, double baudRate, double propDelay, int MTU, + String fileName, String resourceName, int rating) + throws ParameterException, Exception { + + super( name, baudRate, propDelay, MTU, fileName, resourceName, rating ); + } + + /** + * Create a new Workload object <b>with</b> the network extension. + * This means this entity directly sends Gridlets to a destination resource + * through a link. The link is automatically created by this constructor. + * + * @param name this entity name + * @param link the link that will be used to connect this Workload + * to another entity or a Router. + * @param fileName the workload trace filename in one of the following + * format: <i>ASCII text, zip, gz.</i> + * @param resourceName the resource name + * @param rating the resource's PE rating + * @throws Exception This happens when creating this entity before + * initialising GridSim package or this entity name is + * <tt>null</tt> or empty + * @throws ParameterException This happens for the following conditions: + * <ul> + * <li>the entity name is null or empty + * <li>the link is empty + * <li>the workload trace file name is null or empty + * <li>the resource entity name is null or empty + * <li>the resource PE rating <= 0 + * </ul> + * @pre name != null + * @pre link != null + * @pre fileName != null + * @pre resourceName != null + * @pre rating > 0 + * @post $none + */ + public WorkloadWithCancellation(String name, Link link, String fileName, + String resourceName, int rating) + throws ParameterException, Exception { + + super(name, link, fileName, resourceName, rating); + } + + //////////////////////// PRIVATE METHODS /////////////////////// + + /** + * Collects Gridlets sent and stores them into a list. + * @pre $none + * @post $none + */ + protected void collectGridlet() { + System.out.println(super.get_name() + ": Collecting Gridlets ..."); + list_ = new ArrayList(gridletID_ + 1); + + Object data = null; + Gridlet gl = null; + + int counter = 1; // starts at 1, since gridletID_ starts at 1 too + Sim_event ev = new Sim_event(); + while ( Sim_system.running() ) { + + super.sim_get_next(ev); // get the next available event + data = ev.get_data(); // get the event's data + + // handle ping request + if (ev.get_tag() == GridSimTags.INFOPKT_SUBMIT) { + processPingRequest(ev); + continue; + } + + // get the Gridlet data + if (data != null && data instanceof Gridlet) { + gl = (Gridlet) data; + + if(gl.getGridletStatus() == Gridlet.FAILED) + System.out.println("Gridlet failed"); + + if(gl.getGridletStatus() == Gridlet.CANCELED) + System.out.println("Gridlet cancelled"); + + list_.add(gl); + counter++; + } + + // if all the Gridlets have been collected + if (counter == gridletID_) { + break; + } + } + } + + /** + * Creates a Gridlet with the given information, then submit it to a + * resource + * @param id a Gridlet ID + * @param submitTime Gridlet's submit time + * @param runTime Gridlet's run time + * @param numProc number of processors + * @pre id >= 0 + * @pre submitTime >= 0 + * @pre runTime >= 0 + * @pre numProc > 0 + * @post $none + */ + protected void submitGridlet(int id, long submitTime, int runTime, int numProc) { + + // create the gridlet + int len = runTime * rating_; // calculate a job length for each PE + Gridlet gl = new Gridlet(id, len, size_, size_); + gl.setUserID( super.get_id() ); // set the owner ID + gl.setNumPE(numProc); // set the requested num of proc + + // printing to inform user + if (gridletID_ == 1 || gridletID_ % INTERVAL == 0) { + System.out.println(super.get_name() + ": Submitting Gridlets to " + + resName_ + " ..."); + } + + // check the submit time + if (submitTime < 0) { + submitTime = 0; + } + + gridletID_++; // increment the counter + + // submit a gridlet to resource + super.send(super.output, submitTime, GridSimTags.GRIDLET_SUBMIT, + new IO_data(gl, gl.getGridletFileSize(), resID_) ); + + // check whether a cancellation has to be scheduled or not + int result = gridletID_ % NUM_GRIDLETS_BETWEEN_CANCELLATIONS; + if(result == 0) { + super.send(super.output, (submitTime + (TIME_CANCELLATION * runTime)), GridSimTags.GRIDLET_CANCEL, + new IO_data(gl, 0, resID_) ); + gridletID_++; + } + } + +} // end class + Modified: branches/gridsim4.0-branch3/source/gridsim/ARPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/ARPolicy.java 2007-09-14 23:23:03 UTC (rev 60) +++ branches/gridsim4.0-branch3/source/gridsim/ARPolicy.java 2007-09-18 04:17:27 UTC (rev 61) @@ -488,9 +488,9 @@ } /** - * Gets the current time. Time calculates from simulation init time + - * (GridSim.clock * MILLI_SEC). MILLI_SEC = 1000. - * @return current time in seconds + * Gets the current time. Time is calculated from simulation init time + + * (GridSim.clock() * MILLI_SEC), where MILLI_SEC = 1000. + * @return current time in milliseconds * @pre $none * @post $result > 0 */ Modified: branches/gridsim4.0-branch3/source/gridsim/GridSim.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/GridSim.java 2007-09-14 23:23:03 UTC (rev 60) +++ branches/gridsim4.0-branch3/source/gridsim/GridSim.java 2007-09-18 04:17:27 UTC (rev 61) @@ -449,7 +449,7 @@ /** * Sets a <tt>GridInformationService</tt> (GIS) entity. - * This method is useful is you write a different type of GIS entity. + * This method is useful when you want a different type of GIS entity. * This method must be called before {@link #startGridSimulation()} method. * @param gis a GIS object * @return <tt>true</tt> if successful, <tt>false</tt> otherwise @@ -459,7 +459,8 @@ */ public static boolean setGIS(GridInformationService gis) { - if (gis == null) { + // ignore if an existing GIS object has already been created + if (gis == null || gis_ != null) { return false; } Modified: branches/gridsim4.0-branch3/source/gridsim/PERangeList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/PERangeList.java 2007-09-14 23:23:03 UTC (rev 60) +++ branches/gridsim4.0-branch3/source/gridsim/PERangeList.java 2007-09-18 04:17:27 UTC (rev 61) @@ -51,25 +51,28 @@ } /** - * Consolidate PE ranges: e.g. 3-5,5-8,10-20 => 3-8,10-20. - * @pre assumes that the ranges are in order. + * Merges PE ranges: e.g. 3-5,5-8,10-20 => 3-8,10-20. */ - public void consolidatePERanges(){ - PERange currentRange; - PERange nextRange; + public void mergePERanges() { + if(this.size() < 2) // there is nothing to be consolidated + return; + + PERange currentRange; + PERange nextRange; - sortRanges(); - - for(int i=0 ; i<this.size()-1; i++) { - currentRange = this.get(i); - nextRange = this.get(i+1); - - if( currentRange.getEnd() == nextRange.getBeginning() || - (nextRange.getBeginning() - currentRange.getEnd()) == 1 ){ - currentRange.setEnd(nextRange.getEnd()); - this.remove(i+1); - } - } + sortRanges(); // sorts the ranges before + int index = 0; + while(index < super.size()-1){ + currentRange = super.get(index); + nextRange = super.get(index+1); + if( (nextRange.getBeginning() - currentRange.getEnd()) == 1 ){ + currentRange.setEnd(nextRange.getEnd()); + super.remove(index+1); + } + else{ + index++; + } + } } /** @@ -89,7 +92,8 @@ * of the ranges */ public void sortRanges(){ - Collections.sort(this,comparator_); + if(super.size() > 1) + Collections.sort(this, comparator_); } /** @@ -197,8 +201,13 @@ } } } - rIntersec.consolidatePERanges(); - return rIntersec.size() == 0 ? null : rIntersec; + + if( rIntersec.size() == 0) + return null; + else{ + rIntersec.mergePERanges(); + return rIntersec; + } } /** @@ -285,14 +294,12 @@ return null; } - PERangeList query = lista; - query.sortRanges(); + PERangeList difference = lista.clone(); + difference.mergePERanges(); PERangeList universe = listb; universe.sortRanges(); - - PERangeList difference = query.clone(); - + boolean finished = false; while(!finished){ finished = true; @@ -321,7 +328,7 @@ return null; } else{ - difference.consolidatePERanges(); + difference.mergePERanges(); return difference; } } @@ -453,7 +460,7 @@ return null; } else{ - universe.consolidatePERanges(); + universe.mergePERanges(); return universe; } } @@ -502,4 +509,22 @@ return begA.compareTo(begB); } } + + + // FOR DEBUGGING PURPOSES ONLY... + public static void main(String args[]){ + + PERange ra = new PERange(0, 10); + PERange rd = new PERange(31, 50); + PERange rb = new PERange(11, 20); + PERange rc = new PERange(21, 30); + + PERangeList list = new PERangeList(); + list.add(ra); list.add(rb); + list.add(rc); list.add(rd); + + list.mergePERanges(); + + System.out.println("Consolidated# " + list); + } } Modified: branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java 2007-09-14 23:23:03 UTC (rev 60) +++ branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java 2007-09-18 04:17:27 UTC (rev 61) @@ -16,38 +16,48 @@ import java.util.ArrayList; import java.util.Calendar; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.Iterator; import java.util.LinkedList; /** * @link{ParallelSpaceShared} class is an allocation policy for * @link{GridResource} that behaves exactly like First Come First Serve (FCFS) * with conservative backfilling. The policy is based on the conservative - * backfilling algorithm described in: + * backfilling algorithm described in the following papers: * <p> * Dror G. Feitelson and Ahuva Mu'alem Weil, Utilization and Predictability * in Scheduling the IBM SP2 with Backfilling, in Proceedings of the 12th * International Parallel Processing Symposium on International * Parallel Processing Symposium (IPPS 1998), pp. 542-546. * <p> + * Ahuva W. Mu'alem and Dror G. Feitelson, Utilization, Predictability, + * Workloads, and User Runtime Estimates in Scheduling the IBM SP2 with Backfilling. + * IEEE Transactions on Parallel and Distributed Systems, 12:(6), pp. 529-543, 2001. + * <p> * <b>LIMITATIONS:</b><br> * <ul> * <li> The list of machines comprising this resource must be homogeneous. - * <li> Local load is not considered. - * <li> Gridlets cannot be neither paused nor migrated. + * <li> Local load is not considered. If would like to simulate this, you have to + * model the local load as gridlets. It is more precise and faster. + * <li> Gridlets cannot be paused nor migrated. * </ul> - * + * * @author Marcos Dias de Assuncao * @since GridSim Turbo Alpha 0.1 + * * @see gridsim.GridSim * @see gridsim.ResourceCharacteristics * @see gridsim.AllocPolicy + * @see gridsim.PERange + * @see gridsim.PERangeList */ public class ParallelSpaceShared extends AllocPolicy { - private LinkedList<SSGridlet> queuedGridlets_; // Queue of queued Gridlets + private LinkedList<SSGridlet> queuedGridlets_; // Queue of waiting Gridlets private LinkedList<SSGridlet> runningGridlets_; // Queue of running Gridlets private int numPE_; // The total number of PEs in the resource private int ratingPE_; // The rating of one PE @@ -56,8 +66,8 @@ // FOR DEBUGGING PURPOSES ONLY... private ArrayList<AllocationListener> listeners_; // the listeners interested in this policy - private boolean hasListener_; - private double currentTime_; + private boolean hasListener_; // indicates whether there are listeners registered + private double lastActionTime_; // Keep the time of last relevant allocation action /** * Allocates a new @link{ParallelSpaceShared} object @@ -87,7 +97,7 @@ queuedGridlets_ = new LinkedList<SSGridlet>(); availProfile_ = new AvailabilityProfile(); freePERanges_ = new PERangeList(); - currentTime_ = 0.0D; + lastActionTime_ = 0.0D; numPE_ = 0; ratingPE_ = 0; listeners_ = null; @@ -98,8 +108,7 @@ * Handles internal events that come to this entity. */ public void body(){ - - // Gets the information on number of PEs and rating + // Gets the information on number of PEs and rating // of one PE assuming that the machines are homogeneous MachineList list = resource_.getMachineList(); int numMachine = list.size(); @@ -114,8 +123,7 @@ // a loop that is looking for internal events only Sim_event ev = new Sim_event(); - while ( Sim_system.running() ) - { + while ( Sim_system.running() ) { super.sim_get_next(ev); // if the simulation finishes then exit the loop @@ -126,7 +134,7 @@ // Internal Event if the event source is this entity if (ev.get_src() == super.myId_) { - updateSchedule(); + updateSchedule(); } } @@ -145,15 +153,20 @@ * @param ack an acknowledgement, i.e. <tt>true</tt> if the user wants to know * whether this operation is success or not, <tt>false</tt> otherwise. */ - public void gridletSubmit(Gridlet gridlet, boolean ack){ - + public void gridletSubmit(Gridlet gridlet, boolean ack) { int reqPE = gridlet.getNumPE(); double currentTime = GridSim.clock(); + lastActionTime_ = currentTime; try{ // reject the Gridlet if it requires more PEs than the resource // is able to provide if(reqPE > numPE_){ + String userName = GridSim.getEntityName( gridlet.getUserID() ); + System.out.println(super.get_name() + ".gridletSubmit(): " + + " Gridlet #" + gridlet.getGridletID() + " from " + userName + + " user requires " + gridlet.getNumPE() + " PEs."); + System.out.println("--> The resource has only " + numPE_ + " PEs."); gridlet.setGridletStatus(Gridlet.FAILED); super.sendFinishGridlet(gridlet); return; @@ -164,57 +177,44 @@ ": Exception on submission of a Gridlet"); } - SSGridlet rgl = new SSGridlet(gridlet); + // Create a resource Gridlet + SSGridlet sgl = new SSGridlet(gridlet); /////////////// FOR DEBUGGING PURPOSES ONLY //////// if(GridSim.DEBUG_SIMULATION){ - if(hasListener_){ - AllocationAction action = - new AllocationAction(AllocationAction.GRIDLET_ARRIVED, currentTime_); - LinkedList<SSGridlet> list = new LinkedList<SSGridlet>(); - list.add(rgl); - action.setSSGridlet(list); - notifyListeners(action); - } + LinkedList<SSGridlet> list = new LinkedList<SSGridlet>(); + list.add(sgl); + notifyListeners(AllocationAction.GRIDLET_ARRIVED, true, lastActionTime_, list); } ///////////////////////////////////////////////////// - // If there are no jobs in the queue list, then check if - // there are enough PEs to process the job + // there are enough PEs to process the job immediately boolean success = false; int freePE = (freePERanges_ == null) ? 0 : freePERanges_.getNumPE(); if( reqPE <= freePE ){ - success = scheduleJobImmediately(rgl); + success = scheduleGridletImmediately(sgl); } // if the job could not be scheduled immediately, then // find the anchor point where the job can be put if(!success){ - findAnchorPoint(rgl); + findAnchorPoint(sgl); + // add this Gridlet into waiting list + queuedGridlets_.add(sgl); } /////////////// FOR DEBUGGING PURPOSES ONLY //////// + // Notifies the listeners that a Gridlet has been either scheduled + // to run immediately or put in the waiting queue if(GridSim.DEBUG_SIMULATION){ - if(hasListener_){ - AllocationAction action = - new AllocationAction(AllocationAction.GRIDLET_SCHEDULED, currentTime_); - LinkedList<SSGridlet> list = new LinkedList<SSGridlet>(); - list.add(rgl); - action.setSSGridlet(list); - notifyListeners(action); - - if(GridSim.STEP_BY_STEP_SIMULATION){ - GridSim.pauseSimulation(); - } - else if(GridSim.SLOW_MOTION_SIMULATION){ - GridSim.smallPause(); - } - } + LinkedList<SSGridlet> list = new LinkedList<SSGridlet>(); + list.add(sgl); + notifyListeners(AllocationAction.GRIDLET_SCHEDULED, true, lastActionTime_, list); } ///////////////////////////////////////////////////// @@ -226,7 +226,161 @@ ); } } + + /** + * Finds the status of a specified @link{Gridlet}. + * @param gridletId a Gridlet ID + * @param userId the user or owner's ID of this Gridlet + * @return the Gridlet status or <tt>-1</tt> if not found + * @see gridsim.Gridlet + * @pre gridletId > 0 + * @pre userId > 0 + * @post $none + */ + public int gridletStatus(int gridletId,int userId){ + SSGridlet sgl = null; + + // Look for the Gridlet in the running queue + int index = findSSGridlet(runningGridlets_, gridletId, userId); + if (index >= 0) { + // Get the Gridlet from the execution list + sgl = runningGridlets_.get(index); + return sgl.getGridletStatus(); + } + + // Look for the gridlet in the waiting queue + index = findSSGridlet(queuedGridlets_, gridletId, userId); + if (index >= 0) { + // Get the Gridlet from the execution list + sgl = queuedGridlets_.get(index); + return sgl.getGridletStatus(); + } + + // if not found in all lists then report the Gridlet has not found + return -1; + } + + /** + * Cancels a Gridlet running or in the waiting queue. + * This method will search the running and waiting queues. + * The User ID is important as many users might have the same + * Gridlet ID in the lists. If a Gridlet is cancelled, the availability + * profile is shifted forward. This process ensures that the Gridlets + * will not have an expected completion time worse than the one + * initially stipulated for the Gridlet. This process if known + * as the compression of the schedule. For more details please look + * at the references provided at the initial part of this documentation.<br> + * <b>NOTE:</b> + * <ul> + * <li> Before cancelling a Gridlet, this method updates when the expected + * completion time of the Gridlet is. If the completion time is smaller + * than the current time, then the Gridlet is considered to be + * <tt>finished</tt>. Therefore the Gridlet cannot be cancelled. + * + * <li> Once a Gridlet has been cancelled, it cannot be resumed to + * execute again since this method will pass the Gridlet back to + * sender, i.e. the <tt>userId</tt>. + * + * <li> If a Gridlet cannot be found in both execution and paused list, + * then a <tt>null</tt> Gridlet will be send back to sender, + * i.e. the <tt>userId</tt>. + * + * <li> Once a Gridlet is cancelled, the availability profile is swept + * and Gridlets are moved forwards. The entries in the profile incurred + * by each Gridlet are updated and the new anchor for the Gridlet is found + * again. This process is repeated for each Gridlet. This guarantees that + * Gridlets will not have a time completion worse than those initially + * provided. + * </ul> + * + * @param gridletId a Gridlet ID + * @param userId the user or owner's ID of this Gridlet + * @pre gridletId > 0 + * @pre userId > 0 + * @post $none + */ + public void gridletCancel(int gridletId, int userId){ + double currentTime = GridSim.clock(); + lastActionTime_ = currentTime; // set the time of the last allocation action + SSGridlet sgl = null; // stores the gridlet if found + boolean found = false; + + // Look for the Gridlet in the running queue + int index = findSSGridlet(runningGridlets_, gridletId, userId); + if (index >= 0) { + found = true; + + // Get the Gridlet from the execution list + sgl = runningGridlets_.get(index); + + // if the Gridlet's finish time is smaller than the current + // time or the status is FINISHED, it means that the Gridlet + // has finished and will be but has not been removed from + // the running queue yet. It will probably be done shortly, + // so just send a null to the user. + if(sgl.getGridletStatus() == Gridlet.SUCCESS || + sgl.getGridletFinishTime() <= currentTime){ + super.sendCancelGridlet(GridSimTags.GRIDLET_CANCEL, null, gridletId, userId); + return; // return as it is impossible to cancel the Gridlet + } + else{ + // remove from the queue before compressing the schedule + runningGridlets_.remove(index); + } + } + + if(!found){ + // Look for the gridlet in the waiting queue + index = findSSGridlet(queuedGridlets_, gridletId, userId); + if (index >= 0) { + found = true; + + // Get the Gridlet from the waiting queue and + // remove from the queue before compressing the schedule + sgl = queuedGridlets_.remove(index); + } + } + + // If the Gridlet could not be found in neither queue, then send a null + // Gridlet to the user and return because there is no need to + // compress the schedule + if(!found){ + System.out.println(super.resName_ + ".ParallelSpaceShared.gridletCancel():" + + " Cannot find Gridlet #" + gridletId + " for User #" + userId); + super.sendCancelGridlet(GridSimTags.GRIDLET_CANCEL, null, gridletId, userId); + return; + } + ////////////////////////// USED FOR DEBUGGING PURPOSES ONLY /////////////////////// + + if(GridSim.DEBUG_SIMULATION){ + // If a gridlet has been cancelled, then inform the listeners about it + LinkedList<SSGridlet> gridletsCancelled = new LinkedList<SSGridlet>(); + gridletsCancelled.add(sgl); + this.notifyListeners(AllocationAction.GRIDLET_CANCELLED, true, lastActionTime_, gridletsCancelled); + } + + /////////////////////////////////////////////////////////////////////////////////// + + // compress the schedule, that is, moves the gridlets forwards + compressSchedule(sgl); + + ////////////////////////// USED FOR DEBUGGING PURPOSES ONLY /////////////////////// + + if(GridSim.DEBUG_SIMULATION){ + // If a gridlet has been cancelled, then inform the listeners about it + this.notifyListeners(AllocationAction.SCHEDULE_CHANGED, true, lastActionTime_, null); + } + + /////////////////////////////////////////////////////////////////////////////////// + + // sends the Gridlet back to user + sgl.finalizeGridlet(); + super.sendCancelGridlet(GridSimTags.GRIDLET_CANCEL, sgl.getGridlet(), gridletId, userId); + } + + // -------------------- PRIVATE METHODS ---------------------------- + /** * Update the information about the jobs scheduled * @param rgl the resource gridlet @@ -235,48 +389,51 @@ int reqPE = sgl.getNumPE(); // calculate the execution time of the Gridlet - double executionTime = - forecastExecutionTime(ratingPE_, sgl.getRemainingGridletLength()) + 1; + double executionTime = forecastExecutionTime(ratingPE_, sgl.getRemainingGridletLength()); + lastActionTime_ = GridSim.clock(); // keep the time of the last allocation action - this.currentTime_ = GridSim.clock(); + double startTime = -1; // keeps the potential start time of the gridlet + double finishTime = -1; // stores the gridlet's expected finish time + int anchorIndex = -1; // the anchor index, the entry in the profile where the gridlet will be placed + int tailIndex = -1; // insert index represents the position in the profile where + // the entry corresponding to the gridlet's finish time will be placed + ProfileEntry tailEntry = null; // a pointer to the last entry analysed while scanning the profile + ProfileEntry anchorEntry = null; // a pointer to the anchor entry - double startTime = -1; - double finishTime = -1; - int anchorIndex = -1; - int tailIndex = -1; - ProfileEntry tailEntry = null; - ProfileEntry anchorEntry = null; - - AvailabilityProfile clonedProfile = availProfile_.clone(); PERangeList intersectList = null; - - for(ProfileEntry entry : availProfile_){ + int length = availProfile_.size(); + + Iterator<ProfileEntry> iterProfile = availProfile_.iterator(); + while(iterProfile.hasNext()){ + ProfileEntry entry = iterProfile.next(); anchorEntry = entry; anchorIndex = availProfile_.indexOf(anchorEntry); tailEntry = entry; - startTime = entry.getTime(); - finishTime = startTime + executionTime; + startTime = entry.getTime(); // sets the start time as the time of the entry + finishTime = startTime + executionTime; // calculates when the finish time would be if + // the gridlet is put in this position - if(entry.getNumPE() < reqPE) { + // scan the profile until an entry with enough PEs is found + if(entry.getNumPE() < reqPE) { continue; } else { + // if an entry with enough PEs is found, then scan the profile from + // that point onwards analysing the intersection of the ranges available + // in the entries until the gridlet expected completion time intersectList = entry.getPERanges(); - int length = clonedProfile.size(); // Look for the intersection of available ranges from // the anchor until the end of the profile or until // the entries and further than the expected completion time for(int i=anchorIndex+1; i<length; i++){ - ProfileEntry nextEntry = clonedProfile.get(i); + ProfileEntry nextEntry = availProfile_.get(i); if(nextEntry.getTime() > finishTime){ break; } else{ - intersectList = - PERangeList.intersection(intersectList, nextEntry.getPERanges()); - + intersectList = PERangeList.intersection(intersectList, nextEntry.getPERanges()); if(intersectList == null || intersectList.getNumPE() < reqPE){ break; } @@ -285,40 +442,52 @@ } } } - // If a time slot with enough PEs has been found, - // then stop the search + // If a time slot with enough PEs has been found, then stop the search if(intersectList != null && intersectList.getNumPE() >= reqPE){ break; } } } + // Increase the number of gridlets that rely on the anchor point to + // either mark their termination time or anchor + anchorEntry.increaseGridlet(); + anchorIndex = availProfile_.indexOf(anchorEntry); tailIndex = availProfile_.indexOf(tailEntry); // Selects a range to be used by the Gridlet PERangeList selected = selectPERangeList(reqPE, intersectList); - // Creates a new entry to be added to the profile - ProfileEntry newEntry = new ProfileEntry(finishTime); - newEntry.setPERangeList(tailEntry.getPERanges().clone()); - availProfile_.add(tailIndex+1, newEntry); + // If the time of the last entry analysed is equals to the Gridlet + // expected finish time, then a new entry is not needed. + if(tailEntry.getTime() < finishTime){ + // Creates a new entry to be added to the profile + ProfileEntry newEntry = new ProfileEntry(finishTime); + newEntry.setPERangeList(tailEntry.getPERanges().clone()); + availProfile_.add(tailIndex+1, newEntry); + } + else{ + // increase the number of gridlets that use this gridlet to + // mark their completion time + tailEntry.increaseGridlet(); + } // updates the entries between anchor and tail for(int index=anchorIndex; index<=tailIndex; index++){ ProfileEntry entry = availProfile_.get(index); + if(entry.getTime() == finishTime){ + break; + } PERangeList updList = PERangeList.difference(entry.getPERanges(), selected); entry.setPERangeList(updList); } - // add this Gridlet into execution list - this.queuedGridlets_.add(sgl); - // Sets the list of ranges used by the gridlet sgl.setPERangeList(selected); // change Gridlet status - sgl.setGridletStatus(Gridlet.QUEUED); + sgl.setGridletStatus(Gridlet.QUEUED); sgl.setGridletPotentialStartTime(startTime); sgl.setFinishTime(finishTime); @@ -333,7 +502,7 @@ * @pre rgl != null * @post $none */ - private boolean scheduleJobImmediately(SSGridlet sgl) { + private boolean scheduleGridletImmediately(SSGridlet sgl) { int reqPE = sgl.getNumPE(); // calculate the execution time of the Gridlet @@ -342,45 +511,51 @@ // calculates how much ahead to look into the availability profile double currentTime = GridSim.clock() ; - double finishTime = currentTime + executionTime; + double finishTime = currentTime + executionTime; // the Gridlet's expected finish time + lastActionTime_ = currentTime; // keep the time of the last allocation action - this.currentTime_ = currentTime; + // freePERanges_ does not need to be clonned here as the + // PERangeList.intersection() method will create a new list of ranges + // with the intersection anyway + PERangeList intersectList = freePERanges_; + ProfileEntry closeGrlTail = null; + int insertIndex = -1; // this denotes where the new entry (if needed) will be added - PERangeList intersectList = freePERanges_.clone(); - ProfileEntry closeGrlTail = null; - int tailIndex = -1; - + // scan the availability profile until the expected termination + // of the Gridlet to check whether enough resources will be available + // for the Gridlet. Stop the search if not enough resources are available for(ProfileEntry entry : availProfile_){ double entryTime = entry.getTime(); if(entryTime < currentTime) { continue; } - else if(entryTime >= finishTime) { + else if(entryTime > finishTime) { break; } else{ closeGrlTail = entry; - tailIndex = availProfile_.indexOf(entry); + insertIndex = availProfile_.indexOf(entry); PERangeList listEntry = entry.getPERanges(); intersectList = PERangeList.intersection(listEntry, intersectList); } } - - tailIndex++; - - // if the number of PEs available over the time slot is smaller + + // if the number of PEs available over the time slot is smaller // than the number of PEs required, then the gridlet cannot be started if(intersectList == null || intersectList.getNumPE() < reqPE){ return false; } - // Selects a list of ranges to be used by the Gridlet + // increment the index. That is, last entry before finish time + 1 + insertIndex++; + + // Select a list of ranges to be used by the Gridlet PERangeList selected = selectPERangeList(reqPE, intersectList); - if(selected.size() == 0){ + if(selected.getNumPE() < reqPE){ return false; } - - // add the information to the usageProfile + + // Gathers the information should be added in the insertIndex PERangeList listCloseGrlTail = null; if(closeGrlTail == null){ listCloseGrlTail = freePERanges_.clone(); @@ -388,28 +563,45 @@ else{ listCloseGrlTail = closeGrlTail.getPERanges().clone(); } - + + // if the time of the entry at insertIndex - 1 is equals to + // the gridlet finish time, then a new entry in the profile + // is not needed. In this case, the entry at insertIndex - 1 + // is updated to show that one more gridlet relies on the entry + // to represent its completion time. This reduces the number of + // entries in the availability profile + boolean addNewEntry = true; + // Updates entries in the profile - for(int index=0; index<tailIndex; index++){ + for(int index=0; index<insertIndex; index++){ ProfileEntry entry = availProfile_.get(index); if(entry.getTime() < currentTime){ continue; } + // if an entry whose time is equals to the gridlet's completion + // is found, then stop the update and sets addNewEntry to true + else if(entry.getTime() == finishTime){ + entry.increaseGridlet(); + addNewEntry = false; + break; + } PERangeList uptList = PERangeList.difference(entry.getPERanges(), selected); entry.setPERangeList(uptList); } - - // subtracts the selected ranges from the free ranges + + // subtracts the selected ranges from the free ranges freePERanges_ = PERangeList.difference(freePERanges_, selected); - - // Creates a new entry to be added to the profile - ProfileEntry newEntry = new ProfileEntry(finishTime); - newEntry.setPERangeList(listCloseGrlTail); - availProfile_.add(tailIndex, newEntry); - + // If a new entry is required, then add it. + if(addNewEntry){ + // Creates a new entry to be added to the profile + ProfileEntry newEntry = new ProfileEntry(finishTime); + newEntry.setPERangeList(listCloseGrlTail); + availProfile_.add(insertIndex, newEntry); + } + // add this Gridlet into execution list - this.runningGridlets_.add(sgl); + runningGridlets_.add(sgl); sgl.setGridletPotentialStartTime(currentTime); sgl.setFinishTime(finishTime); @@ -432,29 +624,30 @@ * availability profile. */ private void updateSchedule(){ + double currentTime = GridSim.clock(); - this.currentTime_ = currentTime; + lastActionTime_ = currentTime; // removes all Gridlets that have already completed from // the queue of running Gridlets PERangeList releasedRanges = new PERangeList(); - LinkedList<SSGridlet> completedGridlets = new LinkedList<SSGridlet>(); + LinkedList<SSGridlet> grlsCompleted = new LinkedList<SSGridlet>(); for(SSGridlet gridlet : runningGridlets_){ - if(gridlet.getGridletFinishTime() <= currentTime && - gridlet.getGridletStatus() != Gridlet.SUCCESS && - gridlet.getGridletStatus() != Gridlet.FAILED){ + // as gridlets are removed from running queue once they finish + // time is smaller than current time, then testing the time + // is enough. There's no need to check status + if(gridlet.getGridletFinishTime() <= currentTime) { // Update the list of ranges released releasedRanges.addAll(gridlet.getPERangeList().clone()); - completedGridlets.add(gridlet); + grlsCompleted.add(gridlet); gridletFinish(gridlet, Gridlet.SUCCESS); } } -// runningGridlets_.removeAll(grlToRemove); - - freePERanges_ = (freePERanges_ == null) ? new PERangeList() : freePERanges_.clone(); + + if(freePERanges_ == null) + freePERanges_ = new PERangeList(); freePERanges_.addAll(releasedRanges); - freePERanges_.sortRanges(); - freePERanges_.consolidatePERanges(); + freePERanges_.mergePERanges(); // Updates the usage profile LinkedList<ProfileEntry> entToRemove = new LinkedList<ProfileEntry>(); @@ -471,13 +664,13 @@ // Start the execution of Gridlets that are queued and whose // potential start execution time is smaller than current time PERangeList allocatedRanges = new PERangeList(); - LinkedList<SSGridlet> grlToRemove = new LinkedList<SSGridlet>(); + LinkedList<SSGridlet> grlsToStart = new LinkedList<SSGridlet>(); for(SSGridlet gridlet : queuedGridlets_){ if(gridlet.getGridletPotentialStartTime() <= currentTime){ // Update the list of ranges allocated allocatedRanges.addAll(gridlet.getPERangeList()); runningGridlets_.add(gridlet); - grlToRemove.add(gridlet); + grlsToStart.add(gridlet); // change Gridlet status gridlet.setGridletStatus(Gridlet.INEXEC); @@ -485,28 +678,24 @@ super.sendInternalEvent(roundUpTime); } } - queuedGridlets_.removeAll(grlToRemove); - freePERanges_ = PERangeList.difference(freePERanges_.clone(), allocatedRanges); + queuedGridlets_.removeAll(grlsToStart); + freePERanges_ = PERangeList.difference(freePERanges_, allocatedRanges); ////////////////////////// USED FOR DEBUGGING PURPOSES ONLY /////////////////////// if(GridSim.DEBUG_SIMULATION){ - if(hasListener_){ - AllocationAction action = - new AllocationAction(AllocationAction.GRIDLET_COMPLETED, currentTime_); - action.setSSGridlet(completedGridlets); - notifyListeners(action); - - if(GridSim.STEP_BY_STEP_SIMULATION){ - GridSim.pauseSimulation(); - } - else if(GridSim.SLOW_MOTION_SIMULATION){ - GridSim.smallPause(); - } + // If a gridlet has started execution or one has finished, + // then inform the listeners + if(grlsToStart.size() > 0 || grlsCompleted.size() > 0){ + notifyListeners(AllocationAction.GRIDLET_COMPLETED, true, lastActionTime_, grlsCompleted); } } - + /////////////////////////////////////////////////////////////////////////////////// + + // finally, remove the gridlets from the running queue + runningGridlets_.removeAll(grlsCompleted); + } /** @@ -516,7 +705,7 @@ * @param status the Gridlet status */ private void gridletFinish(SSGridlet sgl, int status) { - // the order is important! Set the status first then finalize + // the order is important! Set the status first then finalise // due to timing issues in SSGridlet class sgl.setGridletStatus(status); sgl.finalizeGridlet(); @@ -534,25 +723,25 @@ private PERangeList selectPERangeList(int reqPE, PERangeList freeList){ PERangeList selected = new PERangeList(); try{ - freeList.sortRanges(); + freeList.sortRanges(); - for(PERange range: freeList){ - if(range.getNumPE() >= reqPE){ - int beginning = range.getBeginning(); - int end = beginning + reqPE - 1; - selected.add(new PERange(beginning, end)); - break; - } - else{ - selected.add(range); - reqPE -= range.getNumPE(); - } - } - } + for(PERange range: freeList){ + if(range.getNumPE() >= reqPE){ + int beginning = range.getBeginning(); + int end = beginning + reqPE - 1; + selected.add(new PERange(beginning, end)); + break; + } + else{ + selected.add(range.clone()); + reqPE -= range.getNumPE(); + } + } + } catch(NullPointerException ex){ ex.printStackTrace(); - System.out.println("selectPERangeList(): Exception. Number of PEs required = " + reqPE); - System.out.println(availProfile_); + System.out.println("selectPERangeList(): Exception. Number of PEs required# " + reqPE + + "\n Profile# " + availProfile_); } return selected; } @@ -582,34 +771,223 @@ /** * Notifies the listeners about the action performed - * @param action the action performed + * @param allocationAction the action performed + * @param shouldPause indicates whether the simulation should be paused after + * notifying the listeners. <tt>true</tt> indicates that it should pause and + * <tt>false</tt> means that it should not. + * @param time the time when the action took place + * @param gridletList the list of gridlets to provide to the listeners + * + * @see AllocationAction#GRIDLET_ARRIVED + * @see AllocationAction#GRIDLET_SCHEDULED + * @see AllocationAction#GRIDLET_CANCELLED + * @see AllocationAction#GRIDLET_COMPLETED + * @see AllocationAction#SCHEDULE_CHANGED */ - private void notifyListeners(AllocationAction action){ - for(AllocationListener listener : listeners_){ - listener.allocationActionPerformed(action); + private void notifyListeners(int allocationAction, boolean shouldPause, + double time, LinkedList<SSGridlet> gridletList){ + + if(hasListener_){ + AllocationAction action = new AllocationAction(allocationAction, time); + + if(gridletList != null) + action.setSSGridlet(gridletList); + + for(AllocationListener listener : listeners_){ + listener.allocationActionPerformed(action); + } + + if(shouldPause){ + if(GridSim.STEP_BY_STEP_SIMULATION){ + GridSim.pauseSimulation(); + } + else if(GridSim.SLOW_MOTION_SIMULATION){ + GridSim.smallPause(); + } + } } } /** - * Finds the status of a specified @link{Gridlet}. - * @param gridletId a Gridlet ID - * @param userId the user or owner's ID of this Gridlet - * @return the Gridlet status or <tt>-1</tt> if not found - * @see gridsim.Gridlet + * Finds a Gridlet inside a given list. This method needs a combinati... [truncated message content] |
From: <mar...@us...> - 2007-09-14 23:23:04
|
Revision: 60 http://gridsim.svn.sourceforge.net/gridsim/?rev=60&view=rev Author: marcos_dias Date: 2007-09-14 16:23:03 -0700 (Fri, 14 Sep 2007) Log Message: ----------- The javadoc tags @since have been changed as kindly requested by Anthony in a personal communication. "Please remove them instantly to contain the damage level". Modified Paths: -------------- branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java branches/gridsim4.0-branch3/source/gridsim/PERange.java branches/gridsim4.0-branch3/source/gridsim/PERangeList.java branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/SpaceShared.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/GridletPanel.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/services/AcquisitionPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/MessageBody.java branches/gridsim4.0-branch3/source/gridsim/services/Negotiation.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationList.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationMessage.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/Provider.java branches/gridsim4.0-branch3/source/gridsim/services/ProviderCalendar.java branches/gridsim4.0-branch3/source/gridsim/services/ProviderCharacteristics.java branches/gridsim4.0-branch3/source/gridsim/services/ProvisioningPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/Service.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceAttributes.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridTags.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridlet.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequest.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkload.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkloadList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequester.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirement.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirementList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkload.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkloadItem.java branches/gridsim4.0-branch3/source/gridsim/services/SimpleAcquisitionPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/SimpleProvisionPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceFilter.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameFilter.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameTypeFilter.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceTypeFilter.java branches/gridsim4.0-branch3/source/gridsim/services/index/GridServiceRepository.java branches/gridsim4.0-branch3/source/gridsim/services/index/RegionalGSR.java Modified: branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java 2007-09-14 23:23:03 UTC (rev 60) @@ -20,6 +20,7 @@ * @see eduni.simjava.Sim_system * @version 0.1, 25 June 1995 * @author Ross McNab + * @author Marcos Dias de Assuncao (changed this class to use SortedSet) */ public class Evqueue { private SortedSet sortedSet; Modified: branches/gridsim4.0-branch3/source/gridsim/PERange.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/PERange.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/PERange.java 2007-09-14 23:23:03 UTC (rev 60) @@ -13,9 +13,9 @@ * Gridlets. For example, a Gridlet is using a range of PEs (0..4). * * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * @see PERangeList * @see ParallelSpaceShared - * @since GridSim Toolkit 4.2 */ public class PERange implements Cloneable { Modified: branches/gridsim4.0-branch3/source/gridsim/PERangeList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/PERangeList.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/PERangeList.java 2007-09-14 23:23:03 UTC (rev 60) @@ -18,11 +18,10 @@ * to create a profile of ranges available at particular simulation times. * * @author Marcos Dias de Assuncao - * @since GridSim 4.2 - * + * @since GridSim Turbo Alpha 0.1 + * * @see PERange * @see ParallelSpaceShared - * @since GridSim Toolkit 4.2 */ public class PERangeList extends LinkedList<PERange> @@ -482,6 +481,7 @@ /** * Used to sort the list according to the beginning of the ranges * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ class OrderByBegginingAsc implements Comparator<PERange>{ Modified: branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java 2007-09-14 23:23:03 UTC (rev 60) @@ -39,7 +39,7 @@ * </ul> * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 * @see gridsim.GridSim * @see gridsim.ResourceCharacteristics * @see gridsim.AllocPolicy Modified: branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java 2007-09-14 23:23:03 UTC (rev 60) @@ -19,6 +19,7 @@ * the ranges of PEs (Processing Element) allocated to it. * * @author Marcos Dias de Assuncao (copied the most of it from @link{ResGridlet}} + * @since GridSim Turbo Alpha 0.1 */ public class SSGridlet { Modified: branches/gridsim4.0-branch3/source/gridsim/SpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/SpaceShared.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/SpaceShared.java 2007-09-14 23:23:03 UTC (rev 60) @@ -135,12 +135,12 @@ if (gl.getNumPE() > 1) { String userName = GridSim.getEntityName( gl.getUserID() ); -// System.out.println(); -// System.out.println(super.get_name() + ".gridletSubmit(): " + -// " Gridlet #" + gl.getGridletID() + " from " + userName + -// " user requires " + gl.getNumPE() + " PEs."); -// System.out.println("--> Process this Gridlet to 1 PE only."); -// System.out.println(); + System.out.println(); + System.out.println(super.get_name() + ".gridletSubmit(): " + + " Gridlet #" + gl.getGridletID() + " from " + userName + + " user requires " + gl.getNumPE() + " PEs."); + System.out.println("--> Process this Gridlet to 1 PE only."); + System.out.println(); // also adjusted the length because the number of PEs are reduced int numPE = gl.getNumPE(); Modified: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java 2007-09-14 23:23:03 UTC (rev 60) @@ -18,6 +18,8 @@ * passed to the listener. * * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * */ public class AllocationAction { Modified: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java 2007-09-14 23:23:03 UTC (rev 60) @@ -14,6 +14,7 @@ * to display information about the scheduling queues. * * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public interface AllocationListener { Modified: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java 2007-09-14 23:23:03 UTC (rev 60) @@ -14,6 +14,7 @@ * to display information about the scheduling queues. * * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * * @see AllocationAction * @see AllocationListener Modified: branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-09-14 23:23:03 UTC (rev 60) @@ -49,11 +49,13 @@ * <b>NOTE:</b> This visualisation tool should be used for debugging * purposes only. It is useful if you want to evaluate a new allocation * policy for example. A real experiment is not meant to have any - * visualisation features. + * visualisation features. This interface was initially created for + * another simulator called PajFit available at <b>http://pajfit.sourceforge.net/</b>. * * @author Marco A. S. Netto (created this visualisation tool) * @author Marcos Dias de Assuncao (modified this class to be * used by GridSim.) + * @since GridSim Turbo Alpha 0.1 * * @see gridsim.GridSim#startGridSimulation(boolean visualiser) * @see gridsim.ParallelSpaceShared Modified: branches/gridsim4.0-branch3/source/gridsim/gui/GridletPanel.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/GridletPanel.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/gui/GridletPanel.java 2007-09-14 23:23:03 UTC (rev 60) @@ -43,11 +43,14 @@ /** * This class corresponds to the panel that contains information about the * Gridlets received by a Grid resource. This panel displays the list of Gridles. - * If the user clicks on a Gridlet, additional information is shown. + * If the user clicks on a Gridlet, additional information is shown. <br> + * This interface was initially created for another simulator called PajFit + * available at <b>http://pajfit.sourceforge.net/</b>. * * @author Marco A. S. Netto (created this class) * @author Marcos Dias de Assuncao (modified this class to be used by GridSim * and receive updated from the @link{ResourceWindow}) + * @since GridSim Turbo Alpha 0.1 */ public class GridletPanel extends JPanel Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-09-14 23:23:03 UTC (rev 60) @@ -62,10 +62,13 @@ /** * @link{Visualiser} class represents the window that shows the - * scheduling result of a give resource allocation policy. + * scheduling result of a give resource allocation policy. This interface + * was initially created for another simulator called PajFit available + * at <b>http://pajfit.sourceforge.net/</b>. * * @author Marco A. S. Netto * @author Marcos Dias de Assuncao (modified this class to be used by GridSim) + * @since GridSim Turbo Alpha 0.1 */ public class ResourceWindow extends JFrame implements AllocationListener { Modified: branches/gridsim4.0-branch3/source/gridsim/services/AcquisitionPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/AcquisitionPolicy.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/AcquisitionPolicy.java 2007-09-14 23:23:03 UTC (rev 60) @@ -24,7 +24,6 @@ import java.util.List; /** - * * {@link AcquisitionPolicy} is an abstract class that handles the internal * {@link Provider} acquisition policy. It defines the policy for * service or resource acquision by a provider to serve the requests @@ -41,7 +40,7 @@ * @see IGProvisionPolicy * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public abstract class AcquisitionPolicy extends Sim_entity { Modified: branches/gridsim4.0-branch3/source/gridsim/services/MessageBody.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/MessageBody.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/MessageBody.java 2007-09-14 23:23:03 UTC (rev 60) @@ -13,8 +13,8 @@ * In the scope of the WS-Agreement specification, a can be * the agreement offer sent by an initiator to a responder. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * * @see gridsim.services.ServiceGridTags */ Modified: branches/gridsim4.0-branch3/source/gridsim/services/Negotiation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/Negotiation.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/Negotiation.java 2007-09-14 23:23:03 UTC (rev 60) @@ -18,8 +18,8 @@ * WS-Agreement specification, a negotiation can be * seen as an agreement between a provider and a consumer. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * * @see gridsim.services.ServiceGridTags */ Modified: branches/gridsim4.0-branch3/source/gridsim/services/NegotiationList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/NegotiationList.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/NegotiationList.java 2007-09-14 23:23:03 UTC (rev 60) @@ -16,8 +16,8 @@ * This class can be instantiated to model a collection of negotiations * in which a provider is involved. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class NegotiationList extends LinkedList { Modified: branches/gridsim4.0-branch3/source/gridsim/services/NegotiationMessage.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/NegotiationMessage.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/NegotiationMessage.java 2007-09-14 23:23:03 UTC (rev 60) @@ -15,8 +15,8 @@ * In the scope of the WS-Agreement specification, a can be * the agreement offer sent by an initiator to a responder. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * * @see gridsim.services.ServiceGridTags */ Modified: branches/gridsim4.0-branch3/source/gridsim/services/NegotiationPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/NegotiationPolicy.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/NegotiationPolicy.java 2007-09-14 23:23:03 UTC (rev 60) @@ -21,8 +21,8 @@ * @see ProvisioningPolicy * @see AcquisitionPolicy * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public interface NegotiationPolicy { Modified: branches/gridsim4.0-branch3/source/gridsim/services/Provider.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/Provider.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/Provider.java 2007-09-14 23:23:03 UTC (rev 60) @@ -28,7 +28,7 @@ * provider. * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 * * @see NegotiationPolicy * @see ProvisioningPolicy Modified: branches/gridsim4.0-branch3/source/gridsim/services/ProviderCalendar.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ProviderCalendar.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ProviderCalendar.java 2007-09-14 23:23:03 UTC (rev 60) @@ -15,8 +15,8 @@ * a local load on Grid providers that may vary according to the time zone, * time, weekends and holidays. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * * @see gridsim.ResourceCalendar */ Modified: branches/gridsim4.0-branch3/source/gridsim/services/ProviderCharacteristics.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ProviderCharacteristics.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ProviderCharacteristics.java 2007-09-14 23:23:03 UTC (rev 60) @@ -17,8 +17,8 @@ * provider such as time zone, service list, provision policy and * acquisition policy. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class ProviderCharacteristics { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ProvisioningPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ProvisioningPolicy.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ProvisioningPolicy.java 2007-09-14 23:23:03 UTC (rev 60) @@ -33,7 +33,7 @@ * @see AcquisitionPolicy * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public abstract class ProvisioningPolicy extends Sim_entity { Modified: branches/gridsim4.0-branch3/source/gridsim/services/Service.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/Service.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/Service.java 2007-09-14 23:23:03 UTC (rev 60) @@ -22,7 +22,7 @@ * of requests to the service S. * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public abstract class Service { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceAttributes.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceAttributes.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceAttributes.java 2007-09-14 23:23:03 UTC (rev 60) @@ -18,7 +18,7 @@ * @see gridsim.services.Service * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceAttributes { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridTags.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridTags.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridTags.java 2007-09-14 23:23:03 UTC (rev 60) @@ -10,8 +10,8 @@ /** * This class contains additional tags for the ServiceGrid functionalities * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class ServiceGridTags { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridlet.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridlet.java 2007-09-14 23:23:03 UTC (rev 60) @@ -23,7 +23,7 @@ * @see Gridlet * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceGridlet extends Gridlet Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceList.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceList.java 2007-09-14 23:23:03 UTC (rev 60) @@ -16,8 +16,8 @@ * This class can be instantiated to model a collection of services * offered by a service provider. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class ServiceList extends LinkedList { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequest.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequest.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequest.java 2007-09-14 23:23:03 UTC (rev 60) @@ -13,8 +13,8 @@ * A class that defines the basic functionalities of a service * request made by a consumer to a service provider. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 * * @see Provider * @see ProvisioningPolicy Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestList.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestList.java 2007-09-14 23:23:03 UTC (rev 60) @@ -14,8 +14,8 @@ * GridSim ServiceRequestList maintains a * linked-list of ServiceRequest * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class ServiceRequestList extends LinkedList { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkload.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkload.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkload.java 2007-09-14 23:23:03 UTC (rev 60) @@ -22,7 +22,8 @@ * @see ServiceGridlet * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 + * */ public class ServiceRequestWorkload { private ServiceRequest request_; // the service request Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkloadList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkloadList.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkloadList.java 2007-09-14 23:23:03 UTC (rev 60) @@ -21,7 +21,7 @@ * @see ServiceGridlet * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceRequestWorkloadList extends LinkedList { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequester.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequester.java 2007-09-14 23:23:03 UTC (rev 60) @@ -43,9 +43,8 @@ * @see ServiceAttributes * @see ServiceRequest * - * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class ServiceRequester extends GridSim { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirement.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirement.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirement.java 2007-09-14 23:23:03 UTC (rev 60) @@ -20,7 +20,7 @@ * @see ServiceRequirementList * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public abstract class ServiceRequirement { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirementList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirementList.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirementList.java 2007-09-14 23:23:03 UTC (rev 60) @@ -20,7 +20,7 @@ * @see ServiceRequirement * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceRequirementList extends LinkedList { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkload.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkload.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkload.java 2007-09-14 23:23:03 UTC (rev 60) @@ -18,8 +18,8 @@ * access to a given service or can be a list of service gridlets * that have to be executed on resources. * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class ServiceWorkload extends LinkedList { Modified: branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkloadItem.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkloadItem.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkloadItem.java 2007-09-14 23:23:03 UTC (rev 60) @@ -15,7 +15,7 @@ * @see ServiceGridlet * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public interface ServiceWorkloadItem { Modified: branches/gridsim4.0-branch3/source/gridsim/services/SimpleAcquisitionPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/SimpleAcquisitionPolicy.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/SimpleAcquisitionPolicy.java 2007-09-14 23:23:03 UTC (rev 60) @@ -27,7 +27,7 @@ * @see AcquisitionPolicy * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class SimpleAcquisitionPolicy extends AcquisitionPolicy { Modified: branches/gridsim4.0-branch3/source/gridsim/services/SimpleProvisionPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/SimpleProvisionPolicy.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/SimpleProvisionPolicy.java 2007-09-14 23:23:03 UTC (rev 60) @@ -26,7 +26,7 @@ * @see ProvisioningPolicy * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class SimpleProvisionPolicy extends ProvisioningPolicy { Modified: branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceFilter.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceFilter.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceFilter.java 2007-09-14 23:23:03 UTC (rev 60) @@ -21,7 +21,7 @@ * </ol> * @see ServiceNameFilter * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public interface ServiceFilter { Modified: branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameFilter.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameFilter.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameFilter.java 2007-09-14 23:23:03 UTC (rev 60) @@ -13,7 +13,7 @@ /** * Creates a filter based on a service name * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceNameFilter implements ServiceFilter { Modified: branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameTypeFilter.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameTypeFilter.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameTypeFilter.java 2007-09-14 23:23:03 UTC (rev 60) @@ -13,7 +13,7 @@ /** * Creates a filter based on a service name and type * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceNameTypeFilter implements ServiceFilter { Modified: branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceTypeFilter.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceTypeFilter.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceTypeFilter.java 2007-09-14 23:23:03 UTC (rev 60) @@ -13,7 +13,7 @@ /** * Creates a filter based on a service type * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class ServiceTypeFilter implements ServiceFilter { Modified: branches/gridsim4.0-branch3/source/gridsim/services/index/GridServiceRepository.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/index/GridServiceRepository.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/index/GridServiceRepository.java 2007-09-14 23:23:03 UTC (rev 60) @@ -34,7 +34,8 @@ * {@link gridsim.services.index.RegionalGSR} class. * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 + * * @see gridsim.services.index.RegionalGSR */ Modified: branches/gridsim4.0-branch3/source/gridsim/services/index/RegionalGSR.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/services/index/RegionalGSR.java 2007-09-14 07:34:35 UTC (rev 59) +++ branches/gridsim4.0-branch3/source/gridsim/services/index/RegionalGSR.java 2007-09-14 23:23:03 UTC (rev 60) @@ -29,7 +29,7 @@ * offering a service with particular attributes. * * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.1 + * @since GridSim Turbo Alpha 0.1 */ public class RegionalGSR extends RegionalGIS { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-09-14 07:34:31
|
Revision: 59 http://gridsim.svn.sourceforge.net/gridsim/?rev=59&view=rev Author: marcos_dias Date: 2007-09-14 00:34:35 -0700 (Fri, 14 Sep 2007) Log Message: ----------- Workload used in the example. Added Paths: ----------- branches/gridsim4.0-branch3/workloads/ branches/gridsim4.0-branch3/workloads/sdsc_blue_2000.swf Added: branches/gridsim4.0-branch3/workloads/sdsc_blue_2000.swf =================================================================== --- branches/gridsim4.0-branch3/workloads/sdsc_blue_2000.swf (rev 0) +++ branches/gridsim4.0-branch3/workloads/sdsc_blue_2000.swf 2007-09-14 07:34:35 UTC (rev 59) @@ -0,0 +1,1574 @@ + 31466 28 1 180 -1 -1 -1 16 1800 -1 5 55 -1 -1 0 -1 -1 -1 + 31472 743 10 -1 -1 -1 -1 16 600 -1 5 28 -1 -1 3 -1 -1 -1 + 31473 1293 35 45 -1 -1 -1 24 1800 -1 5 213 -1 -1 0 -1 -1 -1 + 31476 1616 22749 23 8 -1 -1 8 21600 -1 1 242 -1 -1 4 -1 -1 -1 + 31478 1902 131750 64398 32 32153 -1 32 64800 -1 1 171 -1 -1 3 -1 -1 -1 + 31480 2215 85592 17655 32 8719 -1 32 18000 -1 1 178 -1 -1 4 -1 -1 -1 + 31481 2276 85692 15489 32 7639 -1 32 18000 -1 1 178 -1 -1 4 -1 -1 -1 + 31482 3051 1421 -1 -1 -1 -1 64 86400 -1 5 266 -1 -1 3 -1 -1 -1 + 31483 3160 0 65 8 -1 -1 8 1800 -1 1 266 -1 -1 0 -1 -1 -1 + 31485 3909 0 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31486 4109 1 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31489 4619 1 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31490 4955 59374 -1 -1 -1 -1 80 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31493 6709 1 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31494 6913 0 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31495 7253 0 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31497 7400 0 180 -1 -1 -1 8 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31498 8148 0 180 -1 -1 -1 8 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31499 9402 407486 64848 128 31090 -1 128 64800 -1 5 90 -1 -1 3 -1 -1 -1 + 31500 9417 1 183 -1 -1 -1 8 1800 -1 5 11 -1 -1 0 -1 -1 -1 + 31501 10817 1 183 -1 -1 -1 8 1800 -1 5 39 -1 -1 0 -1 -1 -1 + 31502 11056 19650 7246 32 5430 -1 32 7200 -1 5 39 -1 -1 2 -1 -1 -1 + 31504 14701 9586 29 8 -1 -1 8 600 -1 1 11 -1 -1 3 -1 -1 -1 + 31505 15922 1 180 -1 -1 -1 16 1800 -1 5 156 -1 -1 0 -1 -1 -1 + 31508 19359 1 180 -1 -1 -1 16 1800 -1 5 156 -1 -1 0 -1 -1 -1 + 31509 19961 1 180 -1 -1 -1 16 1800 -1 5 156 -1 -1 0 -1 -1 -1 + 31510 23552 374714 18617 128 9248 -1 128 28800 -1 1 95 -1 -1 3 -1 -1 -1 + 31511 27021 105479 16597 512 7784 -1 512 27000 -1 5 93 -1 -1 3 -1 -1 -1 + 31512 27971 2929 1774 128 1158 -1 128 5400 -1 1 261 -1 -1 3 -1 -1 -1 + 31513 29458 1 114 8 -1 -1 8 1800 -1 1 108 -1 -1 0 -1 -1 -1 + 31514 55528 167528 72706 256 -1 -1 256 28800 -1 5 99 -1 -1 4 -1 -1 -1 + 31520 56746 239219 43773 128 21782 -1 128 50400 -1 1 118 -1 -1 3 -1 -1 -1 + 31521 57093 34589 9902 16 9791 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31522 57114 31289 9834 16 9731 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31523 57130 26472 9891 16 9793 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31527 58638 11306 31 8 -1 -1 8 21600 -1 1 242 -1 -1 4 -1 -1 -1 + 31530 60144 26 3648 40 1347 -1 40 3600 -1 5 231 -1 -1 3 -1 -1 -1 + 31532 60556 33 3026 8 2970 -1 8 3000 -1 5 250 -1 -1 3 -1 -1 -1 + 31533 60679 25 3026 8 2984 -1 8 3000 -1 5 250 -1 -1 3 -1 -1 -1 + 31534 60688 16 2859 8 2815 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31541 61832 2254 6923 16 6857 -1 16 10800 -1 5 273 -1 -1 3 -1 -1 -1 + 31543 61914 897 -1 -1 -1 -1 256 15300 -1 5 95 -1 -1 3 -1 -1 -1 + 31547 62819 268319 6966 256 3434 -1 256 15300 -1 5 95 -1 -1 3 -1 -1 -1 + 31548 63530 31710 4201 64 4099 -1 64 7200 -1 1 132 -1 -1 3 -1 -1 -1 + 31549 63693 155425 43257 56 33571 -1 56 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 31550 64194 727 2653 8 2593 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31551 64242 3357 2621 8 2574 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31552 64252 5692 2593 8 2539 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31553 64302 284898 -1 -1 -1 -1 80 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31555 65016 187 -1 -1 -1 -1 80 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31556 65458 283504 -1 -1 -1 -1 80 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31557 66089 1 43 8 -1 -1 8 1800 -1 1 30 -1 -1 0 -1 -1 -1 + 31558 66093 32507 55893 8 55611 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31559 66230 67423 35322 8 35181 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31560 66359 1140 -1 -1 -1 -1 8 1800 -1 5 37 -1 -1 1 -1 -1 -1 + 31561 66423 67345 43329 8 43129 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31563 67552 1 41 8 -1 -1 8 1800 -1 1 30 -1 -1 0 -1 -1 -1 + 31564 67670 348 -1 -1 -1 -1 16 300 -1 5 111 -1 -1 3 -1 -1 -1 + 31565 67967 2 50 16 -1 -1 16 1800 -1 1 111 -1 -1 0 -1 -1 -1 + 31569 69771 143186 64898 256 64436 -1 256 64800 -1 5 273 -1 -1 3 -1 -1 -1 + 31570 70473 2 86 8 -1 -1 8 1800 -1 1 49 -1 -1 0 -1 -1 -1 + 31571 70554 306534 86455 256 86069 -1 256 86400 -1 5 273 -1 -1 3 -1 -1 -1 + 31572 70629 1 751 8 -1 -1 8 1800 -1 1 49 -1 -1 0 -1 -1 -1 + 31573 71050 5451 7247 16 7156 -1 16 7200 -1 5 273 -1 -1 3 -1 -1 -1 + 31574 71130 1 74 16 -1 -1 16 1800 -1 1 111 -1 -1 0 -1 -1 -1 + 31583 73128 754 -1 -1 -1 -1 72 12600 -1 5 14 -1 -1 2 -1 -1 -1 + 31584 73239 41 21621 8 2623 -1 8 21600 -1 5 242 -1 -1 4 -1 -1 -1 + 31588 75370 69 -1 -1 -1 -1 32 7200 -1 5 39 -1 -1 2 -1 -1 -1 + 31589 75467 3595 -1 -1 -1 -1 32 7200 -1 5 39 -1 -1 2 -1 -1 -1 + 31590 76964 2 67 8 -1 -1 8 1800 -1 1 39 -1 -1 0 -1 -1 -1 + 31592 77409 2 180 -1 -1 -1 32 1800 -1 5 39 -1 -1 0 -1 -1 -1 + 31593 77628 1 45 8 -1 -1 8 1800 -1 5 39 -1 -1 0 -1 -1 -1 + 31594 77686 2713 2629 8 2581 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31595 77739 2699 2584 8 2539 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31596 77785 1 44 8 -1 -1 8 1800 -1 5 39 -1 -1 0 -1 -1 -1 + 31600 79165 8884 3277 32 1239 -1 32 7200 -1 5 39 -1 -1 2 -1 -1 -1 + 31601 79506 22477 1670 128 1152 -1 128 5400 -1 1 261 -1 -1 3 -1 -1 -1 + 31602 80063 198168 417 256 -1 -1 256 64560 -1 5 264 -1 -1 3 -1 -1 -1 + 31603 81259 317009 3853 256 3793 -1 256 64800 -1 5 273 -1 -1 3 -1 -1 -1 + 31606 83734 335 2577 8 2531 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31607 83912 276 1707 8 1668 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31609 83944 2361 1604 8 1561 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31610 83962 3016 1494 8 1456 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31611 84220 2 181 -1 -1 -1 8 1800 -1 5 37 -1 -1 0 -1 -1 -1 + 31616 84688 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31617 84891 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31622 87069 2 185 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31626 88443 2 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31628 88587 1 181 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 31633 89296 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31636 89497 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31637 89553 69581 22485 336 11102 -1 336 25200 -1 1 138 -1 -1 3 -1 -1 -1 + 31650 91280 2 40 8 -1 -1 8 1800 -1 1 39 -1 -1 0 -1 -1 -1 + 31653 92080 2 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31655 92275 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31661 95253 306884 18599 256 9262 -1 256 64800 -1 1 119 -1 -1 3 -1 -1 -1 + 31662 96562 306772 64852 256 32372 -1 256 64800 -1 5 119 -1 -1 3 -1 -1 -1 + 31664 97397 47875 56698 8 7081 -1 8 72000 -1 1 242 -1 -1 4 -1 -1 -1 + 31665 98077 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31666 98314 1 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31667 98515 3 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31668 98828 2 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31670 105594 192 4193 64 4092 -1 64 7200 -1 1 132 -1 -1 3 -1 -1 -1 + 31671 105941 362259 43441 128 21643 -1 128 64800 -1 1 246 -1 -1 3 -1 -1 -1 + 31672 106544 18089 7503 640 -1 -1 640 41400 -1 5 93 -1 -1 3 -1 -1 -1 + 31673 108737 1588 9854 16 9747 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31674 108746 1579 9851 16 9743 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31675 108755 1570 9838 16 9724 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31676 108765 1639 9811 16 9716 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31677 108779 5580 9868 16 9737 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31678 108789 5532 9903 16 9767 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31679 108800 5559 9862 16 9735 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31680 108810 5511 9810 16 9707 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31681 108822 35 -1 -1 -1 -1 16 10800 -1 5 144 -1 -1 4 -1 -1 -1 + 31682 108870 5490 10844 16 10726 -1 16 10800 -1 5 144 -1 -1 4 -1 -1 -1 + 31683 108879 5442 9886 16 9766 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31684 109916 239067 -1 -1 -1 -1 96 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31685 110187 4134 9853 16 9735 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31686 110201 4120 9860 16 9737 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31687 110212 4148 9859 16 9732 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31688 110223 4137 9839 16 9719 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31689 110234 4125 9844 16 9724 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31690 110246 4114 9863 16 9736 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31691 110258 4346 9835 16 9738 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31692 110268 4168 10042 16 9910 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31693 110278 4119 9841 16 9733 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31694 110298 4023 9850 16 9725 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31696 139232 6043 4233 64 4107 -1 64 7200 -1 1 132 -1 -1 3 -1 -1 -1 + 31697 148214 17 -1 -1 -1 -1 112 86400 -1 5 266 -1 -1 3 -1 -1 -1 + 31698 148408 200794 -1 -1 -1 -1 112 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31699 151792 17 9881 16 9762 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31700 152823 14 9874 16 9746 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31701 152838 43 9866 16 9705 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31702 152860 21 9850 16 9714 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31703 152873 50 9890 16 9741 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31704 152899 22 9927 16 9779 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31705 152920 38 9871 16 9750 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31706 152944 53 9826 16 9704 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31707 152964 5732 9897 16 9741 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31708 152988 5710 9944 16 9745 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31709 153481 253227 -1 -1 -1 -1 256 86400 -1 5 273 -1 -1 3 -1 -1 -1 + 31710 153669 774 7249 16 7168 -1 16 7200 -1 5 273 -1 -1 3 -1 -1 -1 + 31711 154095 4603 9974 16 9805 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31712 154117 7932 9809 16 9702 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31713 154133 8925 9829 16 9713 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31714 154152 7944 9896 16 9757 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31715 154169 9088 9832 16 9730 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31716 154192 8866 9858 16 9720 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31717 154218 14679 9831 16 9718 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31718 154238 12502 9885 16 9776 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31719 154257 12528 9856 16 9726 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31720 154274 12511 9846 16 9727 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31721 154913 8225 9900 16 9792 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31722 154936 8202 9842 16 9736 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31723 154950 11835 9827 16 9705 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31724 154964 11862 9820 16 9713 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31725 154982 8196 9842 16 9724 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31726 154997 8181 9849 16 9734 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31727 155013 11635 9826 16 9706 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31728 155029 11667 10752 16 10626 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31729 155041 11655 9818 16 9695 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31730 155054 11686 9836 16 9723 -1 16 10800 -1 1 144 -1 -1 4 -1 -1 -1 + 31731 155382 123569 449 256 -1 -1 256 9000 -1 5 116 -1 -1 3 -1 -1 -1 + 31733 158923 239344 5024 256 2460 -1 256 15300 -1 1 95 -1 -1 3 -1 -1 -1 + 31734 158938 261816 18847 128 9374 -1 128 28800 -1 1 95 -1 -1 3 -1 -1 -1 + 31736 161061 17954 59369 8 59008 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31737 161141 153739 -1 -1 -1 -1 256 9000 -1 5 116 -1 -1 3 -1 -1 -1 + 31738 161218 8277 9073 200 4453 -1 200 9000 -1 5 116 -1 -1 3 -1 -1 -1 + 31741 162242 2 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31742 162386 93 7233 8 1794 -1 8 7200 -1 5 144 -1 -1 4 -1 -1 -1 + 31744 162440 3 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31745 162676 2 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31746 162813 16302 9695 640 -1 -1 640 41400 -1 5 93 -1 -1 4 -1 -1 -1 + 31747 162964 3 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31748 163165 3 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31750 163960 2 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31751 164198 2 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31752 165623 3 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31753 167867 79340 48628 56 -1 -1 56 43200 -1 5 225 -1 -1 3 -1 -1 -1 + 31754 169151 54312 78382 56 -1 -1 56 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 31765 174709 186100 15159 256 7478 -1 256 64320 -1 1 59 -1 -1 2 -1 -1 -1 + 31766 174794 115086 24831 64 -1 -1 64 63600 -1 5 264 -1 -1 2 -1 -1 -1 + 31770 178180 24352 16550 64 -1 -1 64 18000 -1 5 132 -1 -1 3 -1 -1 -1 + 31771 178181 10612 11603 32 -1 -1 32 9000 -1 5 116 -1 -1 3 -1 -1 -1 + 31773 178313 10475 19623 128 -1 -1 128 9000 -1 5 116 -1 -1 3 -1 -1 -1 + 31774 179006 9780 -1 -1 -1 -1 16 1200 -1 5 116 -1 -1 3 -1 -1 -1 + 31775 180196 347320 18725 128 9304 -1 128 28800 -1 1 95 -1 -1 3 -1 -1 -1 + 31777 180418 2 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31778 180646 3 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31779 188696 28 11665 24 -1 -1 24 1800 -1 5 213 -1 -1 0 -1 -1 -1 + 31780 188720 270 13704 24 -1 -1 24 60 -1 5 213 -1 -1 2 -1 -1 -1 + 31781 201475 113404 -1 -1 -1 -1 128 3600 -1 5 261 -1 -1 3 -1 -1 -1 + 31782 202488 6058 56669 8 7078 -1 8 72000 -1 1 242 -1 -1 4 -1 -1 -1 + 31783 202518 147 196 8 -1 -1 8 21600 -1 5 144 -1 -1 4 -1 -1 -1 + 31784 222098 925 16587 64 16431 -1 64 21600 -1 1 132 -1 -1 3 -1 -1 -1 + 31785 223030 283435 47129 128 46859 -1 128 57600 -1 1 132 -1 -1 3 -1 -1 -1 + 31793 232617 116367 -1 -1 -1 -1 80 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31795 236042 3 88 8 -1 -1 8 1800 -1 1 111 -1 -1 0 -1 -1 -1 + 31796 236096 4 64 -1 -1 -1 32 1800 -1 5 111 -1 -1 0 -1 -1 -1 + 31798 240340 74542 5319 128 2629 -1 128 5400 -1 5 116 -1 -1 3 -1 -1 -1 + 31803 243586 105398 -1 -1 -1 -1 64 86400 -1 5 266 -1 -1 2 -1 -1 -1 + 31807 246931 4 181 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31808 247147 3 181 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31809 247406 3 181 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31810 247450 42 54306 8 54030 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31811 247615 35 37331 8 37074 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31812 247673 4 181 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31813 247808 14902 42195 8 41932 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 31814 247927 5 181 -1 -1 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31816 248414 4 181 -1 -1 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31817 248627 3 181 -1 -1 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31818 249185 5 1857 24 1409 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31819 249414 455309 9402 128 4636 -1 128 28800 -1 1 95 -1 -1 3 -1 -1 -1 + 31823 251294 4 181 -1 -1 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31824 251541 3 181 -1 -1 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31825 251758 3 181 -1 -1 -1 24 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31826 252007 62872 24427 64 17285 -1 64 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 31828 252602 5 181 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31829 252811 3 181 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 31830 253226 167529 11391 56 6821 -1 56 43200 -1 5 225 -1 -1 3 -1 -1 -1 + 31831 253316 61564 30270 64 23779 -1 64 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 31832 255550 59664 27093 64 13484 -1 64 32400 -1 1 73 -1 -1 4 -1 -1 -1 + 31833 267574 13 56685 8 7080 -1 8 72000 -1 1 242 -1 -1 4 -1 -1 -1 + 31834 272193 42989 16503 64 16387 -1 64 21600 -1 1 132 -1 -1 3 -1 -1 -1 + 31835 272397 4 181 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 31837 295761 63 10 -1 -1 -1 32 1800 -1 5 213 -1 -1 0 -1 -1 -1 + 31839 314896 286 -1 -1 -1 -1 8 14400 -1 5 99 -1 -1 4 -1 -1 -1 + 31840 315290 37 9778 8 9606 -1 8 14400 -1 1 99 -1 -1 4 -1 -1 -1 + 31841 316154 1709 7241 16 7147 -1 16 7200 -1 5 273 -1 -1 3 -1 -1 -1 + 31842 316587 1391 10632 128 10458 -1 128 28800 -1 5 99 -1 -1 4 -1 -1 -1 + 31843 318185 28 21627 8 5398 -1 8 21600 -1 5 144 -1 -1 4 -1 -1 -1 + 31844 320510 14 4278 128 2100 -1 128 7200 -1 1 128 -1 -1 3 -1 -1 -1 + 31845 320528 30 1429 16 1369 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31846 321247 18 1433 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31847 321254 11 1435 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31848 321262 44 1435 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31849 321269 38 1989 16 1922 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31850 321277 31 1462 16 1393 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31851 321288 21 1439 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31852 321325 22 1434 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31853 321334 13 1435 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31854 321343 44 1435 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31855 321393 971 1432 16 1373 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31856 321404 1641 1435 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31857 321411 1592 1474 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31858 321421 1665 1433 16 1373 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31860 323657 31 1517 8 1483 -1 8 3000 -1 1 250 -1 -1 3 -1 -1 -1 + 31861 323843 5 4796 8 4746 -1 8 5400 -1 1 250 -1 -1 3 -1 -1 -1 + 31862 323987 22 5425 8 5377 -1 8 5400 -1 5 250 -1 -1 3 -1 -1 -1 + 31863 324112 1095 12653 128 6282 -1 128 12600 -1 5 116 -1 -1 3 -1 -1 -1 + 31864 324114 63 -1 -1 -1 -1 16 64800 -1 5 27 -1 -1 2 -1 -1 -1 + 31865 324157 20 -1 -1 -1 -1 16 64800 -1 5 27 -1 -1 2 -1 -1 -1 + 31866 324283 37997 64845 16 32367 -1 16 64800 -1 5 27 -1 -1 2 -1 -1 -1 + 31867 324368 22 -1 -1 -1 -1 8 64800 -1 5 27 -1 -1 3 -1 -1 -1 + 31869 325443 34 13325 32 6618 -1 32 18000 -1 1 178 -1 -1 4 -1 -1 -1 + 31870 325585 10 7247 16 7169 -1 16 7200 -1 5 273 -1 -1 3 -1 -1 -1 + 31872 327566 1 200 16 -1 -1 16 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31873 327697 11 4929 32 4368 -1 32 7200 -1 1 261 -1 -1 3 -1 -1 -1 + 31875 327887 0 46 16 -1 -1 16 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31878 328169 1 362 16 -1 -1 16 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31879 328306 31 1444 16 1378 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31880 328317 20 1447 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31881 328327 12 1447 16 1380 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31882 328339 40 1442 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31883 328350 29 1442 16 1377 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31884 328361 18 1441 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31885 328371 576 1437 16 1375 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31887 328750 1 85 16 -1 -1 16 1800 -1 1 111 -1 -1 0 -1 -1 -1 + 31893 330806 373921 21570 128 10711 -1 128 28800 -1 1 95 -1 -1 3 -1 -1 -1 + 31895 331559 220003 2788 200 1300 -1 200 54000 -1 1 271 -1 -1 2 -1 -1 -1 + 31898 332887 13 4799 8 4748 -1 8 5400 -1 1 250 -1 -1 3 -1 -1 -1 + 31899 332901 38 4002 8 3958 -1 8 5400 -1 1 250 -1 -1 3 -1 -1 -1 + 31900 333015 44 1431 16 1370 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31901 333028 31 1432 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31903 333073 27 1440 16 1377 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31904 333084 17 1434 16 1370 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31905 333094 7 1440 16 1375 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31906 333105 1 72 8 -1 -1 8 1800 -1 1 28 -1 -1 0 -1 -1 -1 + 31907 333106 35 1439 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31908 333115 27 1445 16 1381 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31909 333146 35 1438 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31910 333155 27 1443 16 1379 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31911 333166 16 1437 16 1373 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31912 333189 34 1437 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31913 333200 64 1440 16 1378 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31915 333276 451 1444 16 1380 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31916 333499 1 50 8 -1 -1 8 1800 -1 1 213 -1 -1 0 -1 -1 -1 + 31919 333845 630416 48425 64 48153 -1 64 64800 -1 1 132 -1 -1 3 -1 -1 -1 + 31920 334037 774 1432 16 1370 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31921 334051 799 1441 16 1377 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31922 334060 830 1440 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31923 334069 864 1438 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31924 334080 894 1438 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31925 334092 923 1440 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31926 334102 872 1441 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31927 334416 129169 20993 512 10445 -1 512 27000 -1 1 93 -1 -1 4 -1 -1 -1 + 31928 334591 45014 18648 640 9280 -1 640 41400 -1 1 93 -1 -1 4 -1 -1 -1 + 31929 334668 149956 21619 512 10730 -1 512 27000 -1 1 93 -1 -1 4 -1 -1 -1 + 31932 335070 1 54 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31934 335172 0 39 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31935 335405 0 56 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31936 335587 30002 21646 16 21526 -1 16 21600 -1 5 273 -1 -1 3 -1 -1 -1 + 31942 336701 1 85 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 31943 336872 95286 17857 64 17748 -1 64 21600 -1 1 132 -1 -1 3 -1 -1 -1 + 31945 337040 0 52 8 -1 -1 8 1800 -1 1 213 -1 -1 0 -1 -1 -1 + 31949 337276 0 46 8 -1 -1 8 1800 -1 1 213 -1 -1 0 -1 -1 -1 + 31950 337371 1 72 8 -1 -1 8 1800 -1 1 213 -1 -1 0 -1 -1 -1 + 31952 337554 1 44 16 -1 -1 16 1800 -1 1 213 -1 -1 0 -1 -1 -1 + 31954 337807 33 4504 128 1693 -1 128 7200 -1 5 128 -1 -1 3 -1 -1 -1 + 31957 338280 33 4998 8 4922 -1 8 7200 -1 1 250 -1 -1 3 -1 -1 -1 + 31958 338290 23 4146 8 4095 -1 8 7200 -1 1 250 -1 -1 3 -1 -1 -1 + 31959 338393 40 1437 16 1370 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31960 338406 27 1447 16 1382 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31961 338421 13 1438 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31962 338457 17 1437 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31963 338469 47 1437 16 1373 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31965 338484 32 1441 16 1373 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31966 338495 21 1438 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31969 339010 47 1437 16 1369 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31970 339021 36 1442 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31971 339030 27 1440 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31972 339039 18 2282 16 2209 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31973 339051 47 1442 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31974 339062 36 1440 16 1372 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31975 339075 23 1448 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31976 339097 43 1439 16 1369 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31977 339109 31 1445 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31978 339120 23 1450 16 1382 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31979 339129 13 24 8 -1 -1 8 1800 -1 5 28 -1 -1 8 -1 -1 -1 + 31980 339131 12 1447 16 1380 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31981 339337 17 1435 16 1371 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31982 339347 51 1446 16 1381 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31983 339355 43 1448 16 1383 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 31984 339474 81281 43247 64 30763 -1 64 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 31987 339967 28 25 8 -1 -1 8 1800 -1 1 21 -1 -1 8 -1 -1 -1 + 31988 340118 624145 21789 128 10821 -1 128 28800 -1 1 95 -1 -1 3 -1 -1 -1 + 31991 340529 45670 19055 40 9393 -1 40 21600 -1 1 277 -1 -1 3 -1 -1 -1 + 31999 341363 1 49 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32002 342122 164337 64854 256 32371 -1 256 64800 -1 5 119 -1 -1 2 -1 -1 -1 + 32003 342201 1 55 8 -1 -1 8 1800 -1 1 156 -1 -1 0 -1 -1 -1 + 32007 342496 0 38 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32009 342634 1 59 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32010 342830 0 71 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32011 343084 1 56 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32012 343094 29481 13615 32 6762 -1 32 18000 -1 1 178 -1 -1 4 -1 -1 -1 + 32017 343444 61847 12984 32 6451 -1 32 18000 -1 1 178 -1 -1 4 -1 -1 -1 + 32022 343991 16817 16246 128 8075 -1 128 16200 -1 5 116 -1 -1 3 -1 -1 -1 + 32023 344210 1 73 8 -1 -1 8 1800 -1 1 156 -1 -1 0 -1 -1 -1 + 32030 344923 17 1449 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32031 344933 7 1451 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32032 344944 37 1466 16 1387 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32033 344955 26 1456 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32034 344965 16 1454 16 1373 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32035 344976 47 1442 16 1376 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32036 344987 36 1441 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32065 346093 16971 23081 8 5760 -1 8 36000 -1 1 144 -1 -1 4 -1 -1 -1 + 32066 346156 16908 1436 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32067 346166 15443 1433 16 1371 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32068 346178 16886 1437 16 1375 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32069 346189 14619 1439 16 1377 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32070 346210 15399 1441 16 1379 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32071 346230 15379 1436 16 1374 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32072 346252 15357 1442 16 1380 -1 16 7200 -1 1 144 -1 -1 4 -1 -1 -1 + 32073 346465 1 84 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32078 347397 207059 17732 64 9383 -1 64 64800 -1 1 169 -1 -1 2 -1 -1 -1 + 32081 347798 401870 41057 64 21913 -1 64 64800 -1 1 169 -1 -1 2 -1 -1 -1 + 32085 349167 400501 3651 80 1774 -1 80 64800 -1 1 266 -1 -1 2 -1 -1 -1 + 32086 349248 657854 -1 -1 -1 -1 96 64800 -1 5 266 -1 -1 2 -1 -1 -1 + 32095 350866 6721 21654 512 10763 -1 512 21600 -1 5 37 -1 -1 2 -1 -1 -1 + 32097 352152 86 -1 -1 -1 -1 1024 600 -1 5 28 -1 -1 3 -1 -1 -1 + 32100 362590 0 84 8 -1 -1 8 1800 -1 1 108 -1 -1 0 -1 -1 -1 + 32103 365706 122205 9049 256 4488 -1 256 9000 -1 5 116 -1 -1 3 -1 -1 -1 + 32105 370566 0 43 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32106 371591 24 22 8 -1 -1 8 3600 -1 1 157 -1 -1 3 -1 -1 -1 + 32107 372003 16 22 8 -1 -1 8 3600 -1 1 157 -1 -1 3 -1 -1 -1 + 32108 372293 21 22 8 -1 -1 8 3600 -1 1 157 -1 -1 4 -1 -1 -1 + 32109 375878 92324 4128 128 2016 -1 128 10800 -1 1 128 -1 -1 3 -1 -1 -1 + 32110 377889 1717 4966 32 4395 -1 32 7200 -1 1 261 -1 -1 3 -1 -1 -1 + 32111 379970 55883 -1 -1 -1 -1 640 46200 -1 5 93 -1 -1 4 -1 -1 -1 + 32112 388056 18 7246 32 6435 -1 32 7200 -1 5 261 -1 -1 3 -1 -1 -1 + 32113 395216 132892 27987 64 13933 -1 64 32400 -1 1 73 -1 -1 4 -1 -1 -1 + 32114 398879 350782 44854 128 22366 -1 128 50400 -1 1 118 -1 -1 3 -1 -1 -1 + 32115 401106 38514 3647 128 1455 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32116 401109 42181 3647 128 1515 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32117 401113 45845 3647 128 1489 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32118 401120 49524 3647 128 1454 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32119 401124 53633 3648 128 1360 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32120 401127 99559 3654 128 1351 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32121 401131 95865 3359 128 1130 -1 128 3600 -1 1 58 -1 -1 3 -1 -1 -1 + 32122 401134 106894 3303 128 1101 -1 128 3600 -1 1 58 -1 -1 3 -1 -1 -1 + 32124 401142 110643 3665 128 1460 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32125 401145 53234 3647 128 1472 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32126 401149 110214 3650 128 1502 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32127 401152 95844 3646 128 1429 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32128 401156 110590 3651 128 1394 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32129 401160 74717 3648 128 1439 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32130 401163 106902 3649 128 1419 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32132 401171 83042 3653 128 1385 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32133 401175 80602 3650 128 1352 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32135 401182 79340 3649 128 1413 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32136 401185 75653 3649 128 1462 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32137 401188 57235 3643 128 1388 -1 128 3600 -1 5 58 -1 -1 3 -1 -1 -1 + 32138 401192 71154 3507 128 1379 -1 128 3600 -1 1 58 -1 -1 3 -1 -1 -1 + 32140 401497 6 11690 16 11607 -1 16 36000 -1 1 144 -1 -1 4 -1 -1 -1 + 32141 401928 0 49 16 -1 -1 16 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32142 402011 0 46 16 -1 -1 16 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32143 402051 0 98 16 -1 -1 16 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32144 402205 3086 11744 16 11650 -1 16 36000 -1 1 144 -1 -1 4 -1 -1 -1 + 32145 402214 16934 -1 -1 -1 -1 16 36000 -1 5 144 -1 -1 4 -1 -1 -1 + 32146 402221 16934 -1 -1 -1 -1 16 36000 -1 5 144 -1 -1 4 -1 -1 -1 + 32147 402226 16935 -1 -1 -1 -1 16 36000 -1 5 144 -1 -1 4 -1 -1 -1 + 32148 402229 0 105 16 -1 -1 16 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32149 402234 16935 -1 -1 -1 -1 16 36000 -1 5 144 -1 -1 4 -1 -1 -1 + 32150 402240 16936 -1 -1 -1 -1 16 36000 -1 5 144 -1 -1 4 -1 -1 -1 + 32151 402364 0 119 16 -1 -1 16 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32152 402654 0 48 16 -1 -1 16 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32153 402828 0 50 8 -1 -1 8 1800 -1 1 41 -1 -1 0 -1 -1 -1 + 32154 402941 0 42 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32156 403136 0 41 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32157 403367 0 36 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32158 404343 1 31 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32161 407522 174029 64857 256 64529 -1 256 64800 -1 5 273 -1 -1 3 -1 -1 -1 + 32162 407701 152029 43245 64 33840 -1 64 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 32163 408460 14643 6756 32 3346 -1 32 7200 -1 1 128 -1 -1 3 -1 -1 -1 + 32166 409264 117911 64836 32 32373 -1 32 64800 -1 5 171 -1 -1 3 -1 -1 -1 + 32173 411053 2239 55909 8 55651 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 32174 411204 2088 35012 8 34840 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 32175 411435 11668 42331 8 42117 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 32178 412775 0 58 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32179 412890 0 84 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32180 413165 0 83 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32184 414060 0 47 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32185 414136 1 45 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32186 414370 0 41 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32187 414389 2686 7246 16 7169 -1 16 7200 -1 5 273 -1 -1 3 -1 -1 -1 + 32188 414425 0 54 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32193 414950 420 -1 -1 -1 -1 16 600 -1 5 273 -1 -1 3 -1 -1 -1 + 32194 415011 156352 64381 256 31124 -1 256 64320 -1 5 59 -1 -1 2 -1 -1 -1 + 32196 415399 159996 64377 256 31892 -1 256 64320 -1 5 59 -1 -1 2 -1 -1 -1 + 32198 416070 8281 7247 16 7170 -1 16 7200 -1 5 273 -1 -1 3 -1 -1 -1 + 32204 417719 0 66 8 -1 -1 8 1800 -1 1 49 -1 -1 0 -1 -1 -1 + 32205 417776 1 37 8 -1 -1 8 1800 -1 1 49 -1 -1 0 -1 -1 -1 + 32207 417901 0 84 8 -1 -1 8 1800 -1 1 9 -1 -1 0 -1 -1 -1 + 32209 418148 0 42 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32210 418333 475 -1 -1 -1 -1 64 1200 -1 5 127 -1 -1 3 -1 -1 -1 + 32212 418881 3228 -1 -1 -1 -1 32 1200 -1 5 127 -1 -1 3 -1 -1 -1 + 32213 419030 11227 11708 16 11605 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32214 419073 18579 11738 16 11633 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32215 419190 0 60 8 -1 -1 8 1800 -1 1 268 -1 -1 0 -1 -1 -1 + 32216 419191 22838 11771 16 11667 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32217 419199 25686 11721 16 11606 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32218 419206 39329 11769 16 11653 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32219 419213 39322 11780 16 11657 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32220 419227 37417 11721 16 11603 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32225 420193 544068 5122 256 2510 -1 256 15300 -1 5 95 -1 -1 3 -1 -1 -1 + 32228 420333 135909 25273 336 12576 -1 336 25200 -1 5 138 -1 -1 3 -1 -1 -1 + 32229 420363 0 180 -1 -1 -1 64 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 32232 421497 105832 28864 336 14359 -1 336 28800 -1 5 138 -1 -1 2 -1 -1 -1 + 32237 423136 16633 18003 40 8902 -1 40 21600 -1 1 277 -1 -1 3 -1 -1 -1 + 32240 424167 2963 21645 16 21504 -1 16 21600 -1 5 273 -1 -1 3 -1 -1 -1 + 32242 424991 5038 21646 16 21530 -1 16 21600 -1 5 273 -1 -1 3 -1 -1 -1 + 32245 425903 0 33 8 -1 -1 8 1800 -1 1 9 -1 -1 0 -1 -1 -1 + 32248 427037 0 49 8 -1 -1 8 1800 -1 1 39 -1 -1 0 -1 -1 -1 + 32250 427098 0 64 8 -1 -1 8 1800 -1 1 39 -1 -1 0 -1 -1 -1 + 32257 429643 1 33 8 -1 -1 8 1800 -1 1 97 -1 -1 0 -1 -1 -1 + 32259 429870 161 -1 -1 -1 -1 8 3600 -1 5 73 -1 -1 4 -1 -1 -1 + 32266 430532 151016 43248 56 22760 -1 56 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 32268 430578 0 180 -1 -1 -1 8 1800 -1 5 157 -1 -1 0 -1 -1 -1 + 32272 430929 212 -1 -1 -1 -1 8 1800 -1 5 73 -1 -1 1 -1 -1 -1 + 32276 432225 368603 43247 56 25177 -1 56 43200 -1 5 225 -1 -1 3 -1 -1 -1 + 32279 433312 0 49 8 -1 -1 8 1800 -1 1 39 -1 -1 0 -1 -1 -1 + 32280 433356 316312 64845 64 32362 -1 64 64800 -1 5 27 -1 -1 2 -1 -1 -1 + 32281 433379 0 56 8 -1 -1 8 1800 -1 1 39 -1 -1 0 -1 -1 -1 + 32286 434261 0 41 8 -1 -1 8 1800 -1 1 37 -1 -1 0 -1 -1 -1 + 32287 434394 1 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32291 434927 1 180 -1 -1 -1 16 1800 -1 5 59 -1 -1 0 -1 -1 -1 + 32297 436294 0 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32298 436486 0 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32305 437604 1 37 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32306 437643 1 1834 32 1264 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32307 437675 0 41 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32308 437954 0 57 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32309 438125 0 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32311 438767 0 181 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32312 438869 0 35 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32313 439055 157 5529 16 2735 -1 16 7200 -1 1 128 -1 -1 3 -1 -1 -1 + 32314 439071 0 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32316 439323 0 181 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32319 439871 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32320 439873 1 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32321 440121 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32322 440417 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32323 440497 0 63 -1 -1 -1 8 1800 -1 5 72 -1 -1 0 -1 -1 -1 + 32324 440662 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32325 440675 1317 22 8 -1 -1 8 120 -1 1 37 -1 -1 1 -1 -1 -1 + 32326 440859 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32327 441146 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32328 441370 0 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32329 441605 1 180 -1 -1 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32330 442083 276 -1 -1 -1 -1 192 64140 -1 5 59 -1 -1 2 -1 -1 -1 + 32331 442668 86330 -1 -1 -1 -1 192 64140 -1 5 264 -1 -1 2 -1 -1 -1 + 32333 443421 0 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32334 443789 0 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32338 451835 12173 10652 32 2941 -1 32 16200 -1 1 111 -1 -1 4 -1 -1 -1 + 32340 453212 8879 11738 16 11635 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32341 453220 16288 11727 16 11637 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32342 453231 10852 11679 16 11594 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32343 453239 10844 11697 16 11611 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32346 463575 11 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32351 476961 2599 8635 32 7475 -1 32 10800 -1 1 261 -1 -1 3 -1 -1 -1 + 32352 480099 8103 17827 64 17712 -1 64 21600 -1 1 132 -1 -1 3 -1 -1 -1 + 32353 481222 34262 6486 128 2580 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32354 482063 36756 7250 128 3060 -1 128 7200 -1 5 58 -1 -1 3 -1 -1 -1 + 32355 482067 180871 6767 128 2779 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32356 482071 38570 6483 128 2575 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32357 482075 71715 5807 128 2237 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32358 482078 77771 4305 128 1524 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32360 482086 64182 3233 128 1101 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32363 484620 19756 3592 128 1758 -1 128 7200 -1 1 128 -1 -1 3 -1 -1 -1 + 32365 488856 480546 43247 64 30158 -1 64 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 32366 488902 1 1857 32 1254 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32368 489725 17 21649 16 21491 -1 16 21600 -1 5 273 -1 -1 3 -1 -1 -1 + 32369 489772 16693 21637 16 21481 -1 16 21600 -1 5 273 -1 -1 3 -1 -1 -1 + 32370 491145 0 1858 32 1270 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32373 493244 0 1855 32 1250 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32374 493261 14106 11737 16 11635 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32375 493268 15360 11744 16 11624 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32376 493275 15353 11736 16 11607 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32377 493283 15571 11716 16 11611 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32378 493291 15563 11765 16 11666 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32379 493297 15557 11733 16 11623 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32380 493305 15549 11743 16 11641 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32381 495344 0 1850 32 1252 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32382 498261 439 -1 -1 -1 -1 8 1200 -1 5 37 -1 -1 1 -1 -1 -1 + 32393 499869 7 -1 -1 -1 -1 8 1800 -1 5 9 -1 -1 2 -1 -1 -1 + 32404 501701 23930 2436 48 1392 -1 48 36000 -1 1 60 -1 -1 2 -1 -1 -1 + 32409 502808 1 180 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32417 505478 0 267 8 -1 -1 8 1800 -1 1 37 -1 -1 0 -1 -1 -1 + 32418 506022 5337 53903 8 53682 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 32419 506159 5239 36690 8 36487 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 32420 506343 5055 44331 8 44004 -1 8 64800 -1 1 143 -1 -1 3 -1 -1 -1 + 32423 506797 256042 37631 256 18666 -1 256 64800 -1 1 119 -1 -1 3 -1 -1 -1 + 32427 507156 1660 17768 64 17637 -1 64 21600 -1 1 132 -1 -1 3 -1 -1 -1 + 32429 507260 0 57 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32432 507970 1 180 -1 -1 -1 16 1800 -1 5 37 -1 -1 0 -1 -1 -1 + 32433 508121 1 41 8 -1 -1 8 1800 -1 1 240 -1 -1 0 -1 -1 -1 + 32434 508307 0 44 8 -1 -1 8 1800 -1 1 240 -1 -1 0 -1 -1 -1 + 32436 508546 0 34 8 -1 -1 8 1800 -1 1 240 -1 -1 0 -1 -1 -1 + 32437 508675 0 85 32 -1 -1 32 1800 -1 1 37 -1 -1 0 -1 -1 -1 + 32439 508937 0 53 8 -1 -1 8 1800 -1 1 240 -1 -1 0 -1 -1 -1 + 32440 509127 0 57 8 -1 -1 8 1800 -1 1 240 -1 -1 0 -1 -1 -1 + 32442 509293 1 84 32 -1 -1 32 1800 -1 1 225 -1 -1 0 -1 -1 -1 + 32447 509692 1 60 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32448 509705 1 1845 32 1248 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32449 509791 0 36 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32450 509851 0 50 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32451 509916 0 59 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32453 510006 1 45 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32454 510063 1 63 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32456 510133 0 31 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32460 510807 16529 11763 16 11604 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32461 510815 16558 11753 16 11630 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32462 510822 17321 11687 16 11598 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32464 510828 17465 11749 16 11636 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32465 510837 28344 11718 16 11617 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32466 510845 28298 11736 16 11614 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32467 510857 28995 11692 16 11601 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32468 510858 4661 1247 64 1183 -1 64 1200 -1 5 127 -1 -1 3 -1 -1 -1 + 32469 510990 459188 43249 64 28067 -1 64 43200 -1 5 225 -1 -1 2 -1 -1 -1 + 32470 511029 0 56 8 -1 -1 8 1800 -1 1 73 -1 -1 0 -1 -1 -1 + 32474 511716 15620 21628 16 21448 -1 16 21600 -1 5 273 -1 -1 3 -1 -1 -1 + 32475 511783 1 1859 32 1253 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32478 512561 1 37 8 -1 -1 8 1800 -1 1 240 -1 -1 0 -1 -1 -1 + 32489 514975 11628 1678 16 1615 -1 16 64800 -1 1 37 -1 -1 2 -1 -1 -1 + 32490 515127 1 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32494 515811 1 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32495 516009 0 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32499 516408 0 191 8 -1 -1 8 1800 -1 1 246 -1 -1 0 -1 -1 -1 + 32502 517169 1 72 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32504 517573 20 4847 64 4768 -1 64 4800 -1 5 127 -1 -1 3 -1 -1 -1 + 32512 518876 14 326 8 -1 -1 8 300 -1 5 111 -1 -1 3 -1 -1 -1 + 32513 519060 1 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32514 519304 0 181 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32515 519541 1 180 -1 -1 -1 64 1800 -1 5 264 -1 -1 0 -1 -1 -1 + 32516 519729 1 64 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32519 519897 1 53 8 -1 -1 8 1800 -1 1 157 -1 -1 0 -1 -1 -1 + 32531 522520 102226 12224 40 9601 -1 40 28800 -1 5 87 -1 -1 4 -1 -1 -1 + 32537 522884 36843 13517 32 6714 -1 32 18000 -1 1 178 -1 -1 4 -1 -1 -1 + 32539 523314 1 49 8 -1 -1 8 1800 -1 1 79 -1 -1 0 -1 -1 -1 + 32547 523881 1 41 8 -1 -1 8 1800 -1 1 9 -1 -1 0 -1 -1 -1 + 32563 526266 1 180 -1 -1 -1 8 1800 -1 5 79 -1 -1 0 -1 -1 -1 + 32566 527407 1 180 -1 -1 -1 8 1800 -1 5 11 -1 -1 0 -1 -1 -1 + 32567 527452 2 125 -1 -1 -1 8 1800 -1 5 79 -1 -1 0 -1 -1 -1 + 32568 527562 248373 7323 192 3579 -1 192 64080 -1 1 264 -1 -1 2 -1 -1 -1 + 32569 527665 1 63 -1 -1 -1 8 1800 -1 5 79 -1 -1 0 -1 -1 -1 + 32570 527765 0 34 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32571 527805 0 84 8 -1 -1 8 1800 -1 1 11 -1 -1 0 -1 -1 -1 + 32572 527983 0 181 -1 -1 -1 32 1800 -1 5 246 -1 -1 0 -1 -1 -1 + 32573 528487 254847 64158 192 31779 -1 192 64080 -1 5 264 -1 -1 2 -1 -1 -1 + 32574 528828 11250 11715 16 11612 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32575 528836 26916 11740 16 11634 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32576 528845 22975 11783 16 11679 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32577 528854 30996 11838 16 11702 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32578 528860 38646 11722 16 11613 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32579 528870 30980 11747 16 11626 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32580 528878 30972 11819 16 11692 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32581 528946 265613 39857 192 19622 -1 192 64140 -1 1 59 -1 -1 2 -1 -1 -1 + 32583 530039 9065 23 8 -1 -1 8 600 -1 1 11 -1 -1 3 -1 -1 -1 + 32584 530282 180115 -1 -1 -1 -1 336 36000 -1 5 138 -1 -1 3 -1 -1 -1 + 32585 530534 174253 -1 -1 -1 -1 336 36000 -1 5 138 -1 -1 3 -1 -1 -1 + 32586 534758 68360 17752 64 17615 -1 64 21600 -1 1 132 -1 -1 3 -1 -1 -1 + 32587 535009 521876 56617 64 56351 -1 64 64800 -1 1 132 -1 -1 3 -1 -1 -1 + 32588 538170 108271 16263 256 8068 -1 256 16200 -1 5 116 -1 -1 3 -1 -1 -1 + 32589 542148 17702 11776 16 11649 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32590 542159 23143 11688 16 11593 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32591 542167 39381 11697 16 11603 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32592 542174 17676 11789 16 11658 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32593 542181 21436 11755 16 11638 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32594 542187 51268 11721 16 11597 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32595 542196 52210 11741 16 11633 -1 16 16200 -1 1 144 -1 -1 4 -1 -1 -1 + 32597 559669 450274 46903 128 46722 -1 128 57600 -1 1 132 -1 -1 3 -1 -1 -1 + 32598 559992 52039 12706 64 10887 -1 64 14400 -1 1 261 -1 -1 3 -1 -1 -1 + 32599 567494 95444 6826 128 2791 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32600 567498 102251 6661 128 2703 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32601 567503 382743 6341 128 2570 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32602 567509 102279 5256 128 2019 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32604 567520 110275 8675 128 -1 -1 128 7200 -1 5 58 -1 -1 3 -1 -1 -1 + 32605 567525 234405 3830 128 1476 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32606 567529 396732 3877 128 1469 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32607 567534 396727 7247 128 2790 -1 128 7200 -1 5 58 -1 -1 3 -1 -1 -1 + 32608 567538 396723 7247 128 2769 -1 128 7200 -1 5 58 -1 -1 3 -1 -1 -1 + 32609 567543 235495 6105 128 2300 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32610 567548 238255 5881 128 2360 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32612 567557 376899 4313 128 1657 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32613 567561 376894 3645 128 1444 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32614 567566 400637 2970 128 1177 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32615 567570 539453 3354 128 1261 -1 128 7200 -1 1 58 -1 -1 3 -1 -1 -1 + 32617 575593 0 1849 32 1251 -1 32 1800 -1 5 225 -1 -1 0 -1 -1 -1 + 32618 575930 363052 -1 -1 -1 -1 128 57600 ... [truncated message content] |
From: <mar...@us...> - 2007-09-14 07:33:31
|
Revision: 58 http://gridsim.svn.sourceforge.net/gridsim/?rev=58&view=rev Author: marcos_dias Date: 2007-09-14 00:33:33 -0700 (Fri, 14 Sep 2007) Log Message: ----------- Alpha version of GridSim Turbo Added Paths: ----------- branches/gridsim4.0-branch3/.classpath branches/gridsim4.0-branch3/.project branches/gridsim4.0-branch3/examples/ branches/gridsim4.0-branch3/examples/examples/ branches/gridsim4.0-branch3/examples/examples/workload/ branches/gridsim4.0-branch3/examples/examples/workload/parallel/ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java branches/gridsim4.0-branch3/source/ branches/gridsim4.0-branch3/source/eduni/ branches/gridsim4.0-branch3/source/eduni/simdiag/ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphClearObject.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphData.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDiagram.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDisplay.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEqn.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEventObject.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphListener.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphLoader.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetAxes.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetScale.java branches/gridsim4.0-branch3/source/eduni/simdiag/GraphWindow.java branches/gridsim4.0-branch3/source/eduni/simdiag/TimingDiagram.java branches/gridsim4.0-branch3/source/eduni/simdiag/TimingWindow.java branches/gridsim4.0-branch3/source/eduni/simdiag/TraceEventObject.java branches/gridsim4.0-branch3/source/eduni/simdiag/TraceListener.java branches/gridsim4.0-branch3/source/eduni/simdiag/TraceLoader.java branches/gridsim4.0-branch3/source/eduni/simdiag/TraceSaver.java branches/gridsim4.0-branch3/source/eduni/simdiag/Traceable.java branches/gridsim4.0-branch3/source/eduni/simdiag/package.html branches/gridsim4.0-branch3/source/eduni/simjava/ branches/gridsim4.0-branch3/source/eduni/simjava/Evqueue.java branches/gridsim4.0-branch3/source/eduni/simjava/Semaphore.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_accum.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_any_p.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_event.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_exception.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_from_p.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_none_p.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_not_from_p.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_not_type_p.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_outfile.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_output.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_port.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_predicate.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_reporter.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_reportfile.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_stat.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_stat_exception.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_type_p.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/ branches/gridsim4.0-branch3/source/eduni/simjava/distributions/ContinuousGenerator.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/DiscreteGenerator.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Generator.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_bernoulli_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_beta_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_betaprime_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_binomial_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_cauchy_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_chisquare_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_erlang_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_f_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_gamma_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_geometric_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_invgamma_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_logistic_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_lognormal_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_negexp_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_normal_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_parameter_exception.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_pareto_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_pascal_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_poisson_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_random_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_tstudent_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_uniform_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/Sim_weibull_obj.java branches/gridsim4.0-branch3/source/eduni/simjava/distributions/package.html branches/gridsim4.0-branch3/source/eduni/simjava/package.html branches/gridsim4.0-branch3/source/gridsim/ branches/gridsim4.0-branch3/source/gridsim/ARGridResource.java branches/gridsim4.0-branch3/source/gridsim/ARObject.java branches/gridsim4.0-branch3/source/gridsim/ARPolicy.java branches/gridsim4.0-branch3/source/gridsim/ARSimpleSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/Accumulator.java branches/gridsim4.0-branch3/source/gridsim/AdvanceReservation.java branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/GridInformationService.java branches/gridsim4.0-branch3/source/gridsim/GridResource.java branches/gridsim4.0-branch3/source/gridsim/GridSim.java branches/gridsim4.0-branch3/source/gridsim/GridSimCore.java branches/gridsim4.0-branch3/source/gridsim/GridSimRandom.java branches/gridsim4.0-branch3/source/gridsim/GridSimShutdown.java branches/gridsim4.0-branch3/source/gridsim/GridSimStandardPE.java branches/gridsim4.0-branch3/source/gridsim/GridSimTags.java branches/gridsim4.0-branch3/source/gridsim/GridStatistics.java branches/gridsim4.0-branch3/source/gridsim/GridUser.java branches/gridsim4.0-branch3/source/gridsim/Gridlet.java branches/gridsim4.0-branch3/source/gridsim/GridletList.java branches/gridsim4.0-branch3/source/gridsim/IO_data.java branches/gridsim4.0-branch3/source/gridsim/Machine.java branches/gridsim4.0-branch3/source/gridsim/MachineList.java branches/gridsim4.0-branch3/source/gridsim/PERange.java branches/gridsim4.0-branch3/source/gridsim/PERangeList.java branches/gridsim4.0-branch3/source/gridsim/ParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/ParameterException.java branches/gridsim4.0-branch3/source/gridsim/ResGridlet.java branches/gridsim4.0-branch3/source/gridsim/ResGridletList.java branches/gridsim4.0-branch3/source/gridsim/ResourceCalendar.java branches/gridsim4.0-branch3/source/gridsim/ResourceCharacteristics.java branches/gridsim4.0-branch3/source/gridsim/ResourceUserList.java branches/gridsim4.0-branch3/source/gridsim/SSGridlet.java branches/gridsim4.0-branch3/source/gridsim/Sim_from_port.java branches/gridsim4.0-branch3/source/gridsim/SpaceShared.java branches/gridsim4.0-branch3/source/gridsim/Stat.java branches/gridsim4.0-branch3/source/gridsim/TimeShared.java branches/gridsim4.0-branch3/source/gridsim/auction/ branches/gridsim4.0-branch3/source/gridsim/auction/Auction.java branches/gridsim4.0-branch3/source/gridsim/auction/AuctionObserver.java branches/gridsim4.0-branch3/source/gridsim/auction/AuctionTags.java branches/gridsim4.0-branch3/source/gridsim/auction/Auctioneer.java branches/gridsim4.0-branch3/source/gridsim/auction/ContinuousDoubleAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/DoubleAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/DutchAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/EnglishAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/FirstPriceSealedBidAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/Message.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageAsk.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageBid.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageCallForBids.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageInformOutcome.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageInformStart.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageRejectBid.java branches/gridsim4.0-branch3/source/gridsim/auction/MessageRejectCallForBid.java branches/gridsim4.0-branch3/source/gridsim/auction/OneSidedAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/Responder.java branches/gridsim4.0-branch3/source/gridsim/auction/ReverseDutchAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/ReverseEnglishAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/ReverseFirstPriceSealedBidAuction.java branches/gridsim4.0-branch3/source/gridsim/auction/package.html branches/gridsim4.0-branch3/source/gridsim/datagrid/ branches/gridsim4.0-branch3/source/gridsim/datagrid/DataGridResource.java branches/gridsim4.0-branch3/source/gridsim/datagrid/DataGridTags.java branches/gridsim4.0-branch3/source/gridsim/datagrid/DataGridUser.java branches/gridsim4.0-branch3/source/gridsim/datagrid/DataGridlet.java branches/gridsim4.0-branch3/source/gridsim/datagrid/File.java branches/gridsim4.0-branch3/source/gridsim/datagrid/FileAttribute.java branches/gridsim4.0-branch3/source/gridsim/datagrid/ReplicaManager.java branches/gridsim4.0-branch3/source/gridsim/datagrid/SimpleReplicaManager.java branches/gridsim4.0-branch3/source/gridsim/datagrid/filter/ branches/gridsim4.0-branch3/source/gridsim/datagrid/filter/FileNameFilter.java branches/gridsim4.0-branch3/source/gridsim/datagrid/filter/Filter.java branches/gridsim4.0-branch3/source/gridsim/datagrid/filter/FilterDataResult.java branches/gridsim4.0-branch3/source/gridsim/datagrid/filter/package.html branches/gridsim4.0-branch3/source/gridsim/datagrid/index/ branches/gridsim4.0-branch3/source/gridsim/datagrid/index/AbstractRC.java branches/gridsim4.0-branch3/source/gridsim/datagrid/index/DataGIS.java branches/gridsim4.0-branch3/source/gridsim/datagrid/index/DataRegionalGIS.java branches/gridsim4.0-branch3/source/gridsim/datagrid/index/RegionalRC.java branches/gridsim4.0-branch3/source/gridsim/datagrid/index/TopRegionalRC.java branches/gridsim4.0-branch3/source/gridsim/datagrid/index/package.html branches/gridsim4.0-branch3/source/gridsim/datagrid/package.html branches/gridsim4.0-branch3/source/gridsim/datagrid/storage/ branches/gridsim4.0-branch3/source/gridsim/datagrid/storage/HarddriveStorage.java branches/gridsim4.0-branch3/source/gridsim/datagrid/storage/Storage.java branches/gridsim4.0-branch3/source/gridsim/datagrid/storage/TapeStorage.java branches/gridsim4.0-branch3/source/gridsim/datagrid/storage/package.html branches/gridsim4.0-branch3/source/gridsim/filter/ branches/gridsim4.0-branch3/source/gridsim/filter/FilterCreateAR.java branches/gridsim4.0-branch3/source/gridsim/filter/FilterGridlet.java branches/gridsim4.0-branch3/source/gridsim/filter/FilterQueryTimeAR.java branches/gridsim4.0-branch3/source/gridsim/filter/FilterResult.java branches/gridsim4.0-branch3/source/gridsim/filter/package.html branches/gridsim4.0-branch3/source/gridsim/gui/ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationAction.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java branches/gridsim4.0-branch3/source/gridsim/gui/AllocationSubject.java branches/gridsim4.0-branch3/source/gridsim/gui/DetachedMagnifyingGlass.java branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java branches/gridsim4.0-branch3/source/gridsim/gui/GridletPanel.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/index/ branches/gridsim4.0-branch3/source/gridsim/index/AbstractGIS.java branches/gridsim4.0-branch3/source/gridsim/index/RegionalGIS.java branches/gridsim4.0-branch3/source/gridsim/index/package.html branches/gridsim4.0-branch3/source/gridsim/net/ branches/gridsim4.0-branch3/source/gridsim/net/BusLink.java branches/gridsim4.0-branch3/source/gridsim/net/FIFOScheduler.java branches/gridsim4.0-branch3/source/gridsim/net/FloodAdPack.java branches/gridsim4.0-branch3/source/gridsim/net/FloodingRouter.java branches/gridsim4.0-branch3/source/gridsim/net/InfoPacket.java branches/gridsim4.0-branch3/source/gridsim/net/Input.java branches/gridsim4.0-branch3/source/gridsim/net/Link.java branches/gridsim4.0-branch3/source/gridsim/net/NetPacket.java branches/gridsim4.0-branch3/source/gridsim/net/Output.java branches/gridsim4.0-branch3/source/gridsim/net/Packet.java branches/gridsim4.0-branch3/source/gridsim/net/PacketScheduler.java branches/gridsim4.0-branch3/source/gridsim/net/RIPAdPack.java branches/gridsim4.0-branch3/source/gridsim/net/RIPRouter.java branches/gridsim4.0-branch3/source/gridsim/net/RateControlledRouter.java branches/gridsim4.0-branch3/source/gridsim/net/RateControlledScheduler.java branches/gridsim4.0-branch3/source/gridsim/net/Router.java branches/gridsim4.0-branch3/source/gridsim/net/SCFQScheduler.java branches/gridsim4.0-branch3/source/gridsim/net/SimpleLink.java branches/gridsim4.0-branch3/source/gridsim/net/package.html branches/gridsim4.0-branch3/source/gridsim/package.html branches/gridsim4.0-branch3/source/gridsim/services/ branches/gridsim4.0-branch3/source/gridsim/services/AcquisitionPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/MessageBody.java branches/gridsim4.0-branch3/source/gridsim/services/Negotiation.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationList.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationMessage.java branches/gridsim4.0-branch3/source/gridsim/services/NegotiationPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/Provider.java branches/gridsim4.0-branch3/source/gridsim/services/ProviderCalendar.java branches/gridsim4.0-branch3/source/gridsim/services/ProviderCharacteristics.java branches/gridsim4.0-branch3/source/gridsim/services/ProvisioningPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/Service.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceAttributes.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridTags.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceGridlet.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequest.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkload.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequestWorkloadList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequester.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirement.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceRequirementList.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkload.java branches/gridsim4.0-branch3/source/gridsim/services/ServiceWorkloadItem.java branches/gridsim4.0-branch3/source/gridsim/services/SimpleAcquisitionPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/SimpleProvisionPolicy.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceFilter.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameFilter.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceNameTypeFilter.java branches/gridsim4.0-branch3/source/gridsim/services/filter/ServiceTypeFilter.java branches/gridsim4.0-branch3/source/gridsim/services/index/ branches/gridsim4.0-branch3/source/gridsim/services/index/GridServiceRepository.java branches/gridsim4.0-branch3/source/gridsim/services/index/RegionalGSR.java branches/gridsim4.0-branch3/source/gridsim/util/ branches/gridsim4.0-branch3/source/gridsim/util/NetworkReader.java branches/gridsim4.0-branch3/source/gridsim/util/Poisson.java branches/gridsim4.0-branch3/source/gridsim/util/SimReport.java branches/gridsim4.0-branch3/source/gridsim/util/TrafficGenerator.java branches/gridsim4.0-branch3/source/gridsim/util/Workload.java branches/gridsim4.0-branch3/source/gridsim/util/package.html Added: branches/gridsim4.0-branch3/.classpath =================================================================== --- branches/gridsim4.0-branch3/.classpath (rev 0) +++ branches/gridsim4.0-branch3/.classpath 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="source"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="src" path="examples"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: branches/gridsim4.0-branch3/.project =================================================================== --- branches/gridsim4.0-branch3/.project (rev 0) +++ branches/gridsim4.0-branch3/.project 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>gridsim-sf</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java =================================================================== --- branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java (rev 0) +++ branches/gridsim4.0-branch3/examples/examples/workload/parallel/TurboExample01.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,176 @@ + +package examples.workload.parallel; + +import gridsim.GridResource; +import gridsim.GridSim; +import gridsim.Machine; +import gridsim.MachineList; +import gridsim.ResourceCharacteristics; +import gridsim.util.Workload; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.Random; + + +/** + * Test Driver class for this example + */ +public class TurboExample01 +{ + /** + * Creates main() to run this example + */ + public static void main(String[] args) + { + long startTime = System.currentTimeMillis(); + if(args.length == 0){ + System.out.println("Please provide the location of the workload file!"); + System.exit(1); + } + + try { + + ////////////////////////////////////////// + // Get the workload to be used The format should be: + // ASCII text, gzip or zip. + + String fileName = args[0]; + // /Users/marcosd/Documents/workspace/intergrid/workloads/sdsc_blue_2000_400.swf + + ArrayList<GridResource> resources = new ArrayList<GridResource>(); + + ////////////////////////////////////////// + // Initialize the GridSim package. It should be called + // before creating any entities. We can't run this example without + // initializing GridSim first. We will get run-time exception + // error. + + // number of grid user entities + any Workload entities. + int num_user = 1; + Calendar calendar = Calendar.getInstance(); + boolean trace_flag = false; // mean trace GridSim events + + // Initialize the GridSim package without any statistical + // functionalities. Hence, no GridSim_stat.txt file is created. + System.out.println("Initializing GridSim package"); + GridSim.init(num_user, calendar, trace_flag); + + ////////////////////////////////////////// + // Creates one or more GridResource entities + int totalResource = 1; // total number of Grid resources + int rating = 377; // rating of each PE in MIPS + int totalPE = 9; // total number of PEs for each Machine + int totalMachine = 128; // total number of Machines + int i = 0; + + String[] resArray = new String[totalResource]; + for (i = 0; i < totalResource; i++) + { + String resName = "Res_" + i; + GridResource resource = createGridResource(resName, rating, totalMachine, totalPE); + resources.add(resource); + + // add a resource name into an array + resArray[i] = resName; + } + + ////////////////////////////////////////// + // Creates one Workload trace entity. + + int resID = 0; + Random r = new Random(); + resID = r.nextInt(totalResource); + Workload workload = new Workload("Load_1", fileName, resArray[resID], rating); + + ////////////////////////////////////////// + // Starts the simulation in debug mode + GridSim.startGridSimulation(true); + + // Start the simulation in normal mode +// GridSim.startGridSimulation(); + + ////////////////////////////////////////// + // Final step: Prints the Gridlets when simulation is over + long finishTime = System.currentTimeMillis(); + System.out.println("The simulation took " + (finishTime - startTime) + " milliseconds"); + + // prints the Gridlets inside a Workload entity + // workload.printGridletList(trace_flag); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Creates one Grid resource. A Grid resource contains one or more + * Machines. Similarly, a Machine contains one or more PEs (Processing + * Elements or CPUs). + * @param name a Grid Resource name + * @param peRating rating of each PE + * @param totalMachine total number of Machines + * @param totalPE total number of PEs for each Machine + */ + private static GridResource createGridResource(String name, int peRating, + int totalMachine, int totalPE) + { + + ////////////////////////////////////////// + // Here are the steps needed to create a Grid resource: + // 1. We need to create an object of MachineList to store one or more + // Machines + MachineList mList = new MachineList(); + + for (int i = 0; i < totalMachine; i++) + { + ////////////////////////////////////////// + // 4. Create one Machine with its id and list of PEs or CPUs + mList.add( new Machine(i, totalPE, peRating) ); + } + + ////////////////////////////////////////// + // 5. Create a ResourceCharacteristics object that stores the + // properties of a Grid resource: architecture, OS, list of + // Machines, allocation policy: time- or space-shared, time zone + // and its price (G$/PE time unit). + String arch = "Sun Ultra"; // system architecture + String os = "Solaris"; // operating system + double time_zone = 0.0; // time zone this resource located + double cost = 3.0; // the cost of using this resource + + ResourceCharacteristics resConfig = new ResourceCharacteristics( + arch, os, mList, ResourceCharacteristics.PARALLEL_SPACE_SHARED, + time_zone, cost); + + ////////////////////////////////////////// + // 6. Finally, we need to create a GridResource object. + double baud_rate = 10000.0; // communication speed + long seed = 11L*13*17*19*23+1; + double peakLoad = 0.0; // the resource load during peak hour + double offPeakLoad = 0.0; // the resource load during off-peak hr + double holidayLoad = 0.0; // the resource load during holiday + + // incorporates weekends so the grid resource is on 7 days a week + LinkedList Weekends = new LinkedList(); + Weekends.add(new Integer(Calendar.SATURDAY)); + Weekends.add(new Integer(Calendar.SUNDAY)); + + // incorporates holidays. However, no holidays are set in this example + LinkedList Holidays = new LinkedList(); + GridResource gridRes = null; + try { + gridRes = new GridResource(name, baud_rate, seed, + resConfig, peakLoad, offPeakLoad, holidayLoad, Weekends, + Holidays); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Creates one Grid resource with name = " + name); + return gridRes; + } +} // end class + Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphClearObject.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphClearObject.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphClearObject.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,7 @@ +package eduni.simdiag; + +/** Clears graph */ +public class GraphClearObject extends GraphEventObject { + public GraphClearObject(Object src) { super(src); } + public void doit(GraphDiagram d) { d.clear(); } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphClearObject.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphData.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphData.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphData.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,39 @@ +package eduni.simdiag; + +import java.util.StringTokenizer; + +/** Stores a single data point. + * + * Each data point has a line name and X and Y coordinates. + */ +public class GraphData extends GraphEventObject { + public String linename; + public double x,y; + + /** Constructs data elem from a single text line + * Format: linename x y + * e.g. "total_time 10 123.45" + */ + public GraphData(Object src, String l) { + super(src); + StringTokenizer st = new StringTokenizer(l, " "); + try { + linename = st.nextToken(); + x = (Double.valueOf(st.nextToken())).doubleValue(); + y = (Double.valueOf(st.nextToken())).doubleValue(); + } catch( Exception e) { + System.out.println("Graphdata Couldn't parse "+l); + } + } + + /** Constructs data elem from linename, x and y + */ + public GraphData(Object src, String linename, double x, double y){ + super(src); + this.linename = linename; + this.x = x; this.y = y; + } + + /** Called by recipient to implement command */ + public void doit(GraphDiagram d) { d.data(linename,x,y); } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphData.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDiagram.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDiagram.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDiagram.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,353 @@ +/** + * GraphDiagram.java + * simjava graph + */ + +package eduni.simdiag; + +import java.util.List; +import java.util.ArrayList; +import java.awt.Panel; +import java.awt.Graphics; +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Color; +import java.awt.GridLayout; +import java.awt.Frame; +import java.applet.Applet; + +class DPoint { + public double x,y; + public DPoint(double xx, double yy) {x=xx;y=yy;} +} + +class Linedata { + String name; + List points = new ArrayList();// list of points + public Linedata(String n) { name = n; } + public void add(double x, double y) { + points.add(new DPoint(x,y)); + } + public DPoint getDPoint(int i) { return (DPoint)points.get(i); } + public String getName() { return name; } + Color valtocol(int v) { + if (v==0) return Color.blue; + if (v==1) return Color.red; + if (v==2) return Color.darkGray; + if (v==3) return Color.gray; + if (v==4) return Color.green; + if (v==5) return Color.lightGray; + if (v==6) return Color.magenta; + if (v==7) return Color.orange; + if (v==8) return Color.pink; + if (v==9) return Color.cyan; + return valtocol(v%10); + } + + public void draw(Graphics g, int i, GraphPanel p) { + g.setColor(valtocol(i)); + // Join points. + for (int j=0; j<points.size()-1; j++) { + DPoint p1 = (DPoint)points.get(j); + DPoint p2 = (DPoint)points.get(j+1); + g.drawLine(p.xscale(p1.x),p.yscale(p1.y), + p.xscale(p2.x),p.yscale(p2.y)); + } + + int sz = 2; // Cross size. + for (int j=0; j<points.size(); j++) { + DPoint p1 = (DPoint)points.get(j); + int ix = p.xscale(p1.x); + int iy = p.yscale(p1.y); + g.drawLine(ix-sz,iy-sz,ix+sz,iy+sz); + g.drawLine(ix+sz,iy-sz,ix-sz,iy+sz); + } + + // Draw Key (tr) + int kyspc = 20; int kx = p.getSize().width - 100; + int ky = (i+2) * kyspc; + g.drawLine(kx,ky,kx+10,ky); + g.drawString(name,kx+10,ky); + } +} + +class GraphPanel extends Panel { + String xax="X",yax="Y"; + List data = new ArrayList(); // List of Linedata + double xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0; + // Offset of axes + int xoff = 40; + int yoff = 40; + + /** Return linedata given line name, or null if not found */ + Linedata getLine(String n) { + for (int i=0; i<data.size(); i++) { + Linedata ld = (Linedata)data.get(i); + if (n.compareTo(ld.getName())==0) + return ld; + } + return null; + } + GraphPanel() { + super(); + resetScale(); + } + void resetScale() { + xmin=0.0; + xmax=1.0; + ymin=0.0; + ymax=1.0; + } + + public int xscale(double x) { + int w = getSize().width; + return (int)(((x-xmin)/(xmax-xmin)) * (w-xoff)) + xoff; + } + public int yscale(double y) { + int h = getSize().height; + return h-((int)(((y-ymin)/(ymax-ymin)) * (h-yoff)) + yoff); + } + public void clear() { + data.clear(); + resetScale(); + } + + public void setAxes(String xax, String yax) { + this.xax = xax; this.yax = yax; + } + + public void setScale(double xmin,double xmax, double ymin, double ymax) { + this.xmin = xmin; + this.xmax = xmax; + this.ymin = ymin; + this.ymax = ymax; + } + + public void data(String linename, double x, double y) { + Linedata ld = getLine(linename); + if (ld==null) { + ld = new Linedata(linename); + data.add(ld); + } + ld.add(x,y); + if (x > xmax) xmax = x; + if (y > ymax) ymax = y; + if (x < xmin) xmin = x; + if (y < ymin) ymin = y; + } + + public void display() { + repaint(); + } + + double log10(double d) { + return Math.log(d)/Math.log(10); + } + + void drawNotches(Graphics g, int x1, int y1, int x2, int y2, + double v1, double v2) { + boolean isXaxis = (y1==y2); + double tsize = v2 - v1; // e.g. 17.2 + double tgaplog = log10( (double) tsize ); // e.g. 1.2ish + int tgaprounded = (int)tgaplog; // e.g. 1 + double tgapfinal = Math.pow( 10.0, (double) tgaprounded ); // e.g.10.0 + // Change to 0 5 10 etc? + if (tsize/tgapfinal < 3.0) { tgapfinal /= 2.0; } + + // Get first point + double div = 0.5 + (v1 / tgapfinal); + int idiv = (int) div; + double firstt1 = idiv * tgapfinal; + + // Draw major notches + if (isXaxis) { + int notchHeight = yoff/10; + for (double t=firstt1; t<=v2; t+=tgapfinal ) { + int xp = xscale(t); + String s = Double.toString(t); + g.setColor(Color.blue); + g.drawLine(xp,y1,xp,notchHeight+y1); + int w = g.getFontMetrics().stringWidth(s); + int h = g.getFontMetrics().getHeight(); + g.drawString(s,xp-w/2,y1+notchHeight+h); + + g.setColor(Color.gray.brighter()); + g.drawLine(xp,y1,xp,0); + } + } else { + int notchHeight = xoff/10; + for (double t=firstt1; t<=v2; t+=tgapfinal ) { + int yp = yscale(t); + String s = Double.toString(t); + g.setColor(Color.blue); + g.drawLine(x1,yp,x1-notchHeight,yp); + int sw = g.getFontMetrics().stringWidth(s); + int sh = g.getFontMetrics().getHeight(); + g.drawString(s,x1-sw-notchHeight,yp+sh/2); + + g.setColor(Color.gray.brighter()); + g.drawLine(x1,yp,getSize().width,yp ); + } + } + + } + + void drawAxes(Graphics g ) { + int w = getSize().width; + int h = getSize().height; + + g.setColor(Color.blue); + g.drawLine(xoff, h-yoff, w, h-yoff); + g.drawLine(xoff, h-yoff, xoff, 0); + g.drawString(xax,w/2,h-yoff/3); + g.drawString(yax,xoff/3,h/2); + + // Draw notches + drawNotches(g,xoff, h-yoff, w, h-yoff,xmin,xmax); + drawNotches(g,xoff, h-yoff, xoff, 0 ,ymin,ymax); + + g.setColor(Color.blue.brighter()); + g.drawLine(xoff, h-yoff+1, w, h-yoff+1); + g.drawLine(xoff+1, h-yoff, xoff+1, 0); + } + + + Image offscreen; + Dimension offscreensize=new Dimension(); + Graphics offg; + + /** Plot the graph */ + public void paint(Graphics g) { + Dimension d = getSize(); + if ((offscreen == null) || (d.width != offscreensize.width) || (d.height != offscreensize.height)) { + offscreen = createImage(d.width, d.height); + offscreensize = d; + offg = offscreen.getGraphics(); + } + + int w = getSize().width; + int h = getSize().height; + System.out.println("Painting "+w+" "+h); + offg.setColor(Color.lightGray.darker()); + offg.fillRect(0,0,w,h); + offg.setColor(Color.lightGray); + offg.fillRect(xoff,0,w,h-yoff); + drawAxes(offg); + + for (int i=0; i<data.size(); i++) { + Linedata ld = (Linedata)data.get(i); + ld.draw(offg,i,this); + } + g.drawImage(offscreen, 0, 0, null); + } +} + +/** + * This class represents the graph application. + * @version 1.0, July 1997 + * @author Fred Howell + */ +public class GraphDiagram extends Applet implements GraphListener, Runnable { + transient Thread thread; + + GraphPanel diag; + + /** Constructs a graph which runs in its own thread. + */ + public GraphDiagram() { + super(); + thread = new Thread(this); + thread.start(); + } + + /** Draws graph */ + public void run() { + init(); + } + /** Graph beans event interface */ + private List graphListeners = new ArrayList(); + + /** Adds a graph listener to the output. */ + public synchronized void addGraphListener(GraphListener l) { + graphListeners.add(l); + } + /** Removes a graph listener from the output. */ + public synchronized void removeGraphListener(GraphListener l) { + graphListeners.remove(l); + } + /** Deals with incoming graph events */ + public void handleGraph(GraphEventObject e) { + e.doit(this); + forwardGraph(e); + } + /** Sends graph events to any listeners */ + public void forwardGraph(GraphEventObject e) { + List l; + synchronized(this) { l = (List)((ArrayList)graphListeners).clone(); } + // GraphEventObject teo = new GraphEventObject(this,e); + // Not bothering to clone the object, make sure sender doesn't change + // it. + for (int i=0; i<l.size(); i++) { + GraphListener tl = (GraphListener) l.get(i); + tl.handleGraph(e); + } + } + + /** Sets up graph diagram display */ + public void init() { + setLayout(new GridLayout(1,1)); + diag = new GraphPanel(); + add(diag); + } + + /** Returns the panel associated with this graph */ + public GraphPanel get_diag() { return diag; } + + /** Clears the graph */ + public void clear() { + diag.clear(); + diag.repaint(); + } + + /** Sets the axes labels */ + public void setAxes(String xax, String yax) { + System.out.println("Setting axes to "+xax+" "+yax); + diag.setAxes(xax,yax); + } + + /** Sets the scale */ + public void setScale(double xmin,double xmax, double ymin, double ymax) { + diag.setScale(xmin,xmax,ymin,ymax); + } + + /** Adds a data element */ + public void data(String linename, double x, double y) { + System.out.println("Data "+linename+" "+x+" "+y); + diag.data(linename,x,y); + } + + /** Displays the graph */ + public void display() { + diag.repaint(); + } + + + /** Constructs an example using the graph, by connecting a + * GraphEqn object to its input to display sine waves. + */ + public static void main(String args[]) { + Frame f = new Frame("Graph Diagram Example"); + GraphDiagram ex1 = new GraphDiagram(); + // GraphLoader tl = new GraphLoader("file:/home/fwh/export/tmp.graph"); + // tl.addGraphListener(ex1); + // tl.startLoading(); + GraphEqn ge = new GraphEqn(); + ge.addGraphListener(ex1); + ge.startRunning(); + + f.add("Center", ex1); + f.pack(); + f.setSize(600,300); + f.show(); + } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDiagram.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDisplay.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDisplay.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDisplay.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,10 @@ +package eduni.simdiag; + +/** Displays graph. Required to update the display after + * a set of <a href="eduni.simdiag.GraphData.html">GraphData</a> commands. + * see also <a href="../design_doc/index.html#twodgraphs">the design document</a>. + */ +public class GraphDisplay extends GraphEventObject { + public GraphDisplay(Object src) { super(src); } + public void doit(GraphDiagram d) { d.display(); } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphDisplay.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEqn.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEqn.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEqn.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,76 @@ +package eduni.simdiag; + +import java.util.List; +import java.util.ArrayList; +import java.applet.Applet; + +/** + * Generates sin/cos graph from equation. + * The output format is a stream of + * GraphEventObjects which can be read and displayed by + * a GraphDiagram. + * This class may be useful as an example of how to + * generate a graph from user simulations: + * see the <a href="../../eduni/simdiag/GraphEqn.java">source code</a> + */ + +public class GraphEqn implements Runnable { + + transient Thread thread; + + /** Creates a graph generator (Sine, Cos) */ + public GraphEqn() { + } + + /** Called after output has been wired */ + public void startRunning() { + thread = new Thread(this); + thread.start(); + } + + /** Generates the graph */ + public void run() { + double delta = 0.1; + // while (true) { + forwardGraph( new GraphClearObject(this) ); + + forwardGraph( new GraphSetAxes(this,"X","Y") ); + + for (double x = 0.0; x<20; x+=0.1) { + forwardGraph( new GraphData(this,"sin",x,Math.sin(x+delta)) ); + forwardGraph( new GraphData(this,"cos",x,Math.cos(x+delta)) ); + + forwardGraph( new GraphDisplay(this) ); + try { thread.sleep(100); } catch (Exception e) {} + } + + forwardGraph( new GraphDisplay(this) ); + delta += 0.1; + // try { thread.sleep(1000); } catch (Exception e) {} + // } + } + + /** Javabeans graph event output: List of + * event listeners. + */ + private List graphListeners = new ArrayList(); + /** Adds a graph listener */ + public synchronized void addGraphListener(GraphListener l) { + graphListeners.add(l); + } + /** Removes a graph listener */ + public synchronized void removeGraphListener(GraphListener l) { + graphListeners.remove(l); + } + /** Forwards a graph event to anyone listening. + */ + public void forwardGraph(GraphEventObject e) { + List l; + // GraphEventObject weo = new GraphEventObject(this,e); + synchronized(this) { l = (List)((ArrayList)graphListeners).clone(); } + for (int i=0; i<l.size(); i++) { + GraphListener wl = (GraphListener) l.get(i); + wl.handleGraph(e); + } + } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEqn.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEventObject.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEventObject.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEventObject.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,26 @@ +package eduni.simdiag; + +import java.util.EventObject; + +/** + * The basic graph event class. + * All graph commands are derived from this and override + * the doit() method. + * @see eduni.simdiag.GraphData + * @see eduni.simdiag.GraphDisplay + * @see eduni.simdiag.GraphSetAxes + * @see eduni.simdiag.GraphSetScale + * @see eduni.simdiag.GraphClearObject + */ + +public class GraphEventObject extends EventObject { + public GraphEventObject(Object src) { + super(src); + } + /** Implements graph commands. + * The graph commands override this to do their biz. + */ + public void doit(GraphDiagram d) { + System.out.println("Executing a basic command\n"); + } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphEventObject.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphListener.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphListener.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphListener.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,14 @@ +package eduni.simdiag; + +import java.util.EventListener; + +/** + * Graph event listener interface. <p> + * Implemented by graph drawing routine. + * @see eduni.simdiag.GraphDiagram + */ + +public interface GraphListener extends EventListener { + /** Responds to a single graph event */ + void handleGraph(GraphEventObject teo); +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphListener.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphLoader.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphLoader.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphLoader.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,99 @@ +/* GraphLoader.java */ + +package eduni.simdiag; + +import java.util.List; +import java.util.ArrayList; +import java.util.EventListener; +import java.applet.Applet; +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; + +/** + * Converts graph from URL to GraphEventListener format. + */ +public class GraphLoader implements Runnable { + + transient Thread thread; + String urlName; + + + /** Create a graph loader with the given url */ + public GraphLoader(String urlName) { + this.urlName = urlName; + thread = new Thread(this); + } + + /** Called after output has been wired */ + public void startLoading() { + thread.start(); + } + + protected String nextLine(BufferedReader r) { + try { + String l = r.readLine(); + return l; + } catch (Exception e) { + return null; + } + } + + public void run() { + URL u; + try { + u = new URL(urlName); + } catch (Exception e) { + System.out.println("Can't open URL "+urlName); + return; + } + + DataInputStream file; + try { + file = new DataInputStream(u.openStream()); + } catch (IOException ioe) { + System.out.println("Couldn't open URL\n"); + return; + } + BufferedReader in = new BufferedReader(new InputStreamReader(file)); + String l; + + int numevents = 0; + + forwardGraph( new GraphClearObject(this) ); + // File fmt: + // axis names, data. + // mem speed\n time\n sys1 10 123.4 etc + String xax = nextLine(in); + String yax = nextLine(in); + forwardGraph( new GraphSetAxes(this,xax,yax) ); + while ((l = nextLine(in))!=null) { + forwardGraph( new GraphData(this,l) ); + numevents += 1; + } + + forwardGraph( new GraphDisplay(this) ); + + System.out.println("Read in "+numevents+" lines"); + } + + /* Javabeans graph event output */ + private List graphListeners = new ArrayList(); + public synchronized void addGraphListener(GraphListener l) { + graphListeners.add(l); + } + public synchronized void removeGraphListener(GraphListener l) { + graphListeners.remove(l); + } + public void forwardGraph(GraphEventObject e) { + List l; + // GraphEventObject weo = new GraphEventObject(this,e); + synchronized(this) { l = (List)((ArrayList)graphListeners).clone(); } + for (int i=0; i<l.size(); i++) { + GraphListener wl = (GraphListener) l.get(i); + wl.handleGraph(e); + } + } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphLoader.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetAxes.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetAxes.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetAxes.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,21 @@ +package eduni.simdiag; + +/** Stores a command to set the axes labels for this graph. + * + */ +public class GraphSetAxes extends GraphEventObject { + String xax,yax; + /** Constructs a setaxes command. + * @param xax The label of the X axis. + * @param yax The label of the Y axis. + */ + + public GraphSetAxes(Object src, String xax, String yax){ + super(src); + this.xax = xax; this.yax=yax; + } + /** Sets the axes labels of the given diagram. + * Called by the recipient of the command. + */ + public void doit(GraphDiagram d) { d.setAxes(xax,yax); } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetAxes.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetScale.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetScale.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetScale.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,14 @@ +package eduni.simdiag; + +/** Sets scale */ +public class GraphSetScale extends GraphEventObject { + double xmin,xmax,ymin,ymax; + public GraphSetScale(Object src, double xmin,double xmax, double ymin, double ymax) { + super(src); + this.xmin = xmin; + this.xmax = xmax; + this.ymin = ymin; + this.ymax = ymax; + } + public void doit(GraphDiagram d) { d.setScale(xmin,xmax,ymin,ymax); } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphSetScale.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/GraphWindow.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/GraphWindow.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,33 @@ +package eduni.simdiag; + +import java.awt.Frame; + +/** A graph diagram in a separate window (and thread). + * <b>Note</b> that it is the GraphDiagram which listens + * to graph event objects, not the GraphWindow. + * + * Usage (from a class which generates GraphObjects) + * <pre> + * GraphWindow gw = new GraphWindow(); + * addGraphListener( gw.getDiag()); + * gw.start(); + * </pre> + */ +public class GraphWindow extends Thread { + Frame f; + GraphDiagram td; + + public GraphWindow() { + f = new Frame("Graph Diagram"); + td = new GraphDiagram(); + } + /** Displays the window */ + public void run() { + // td.init(); + f.add(td); + f.pack(); + f.setVisible(true); + } + /** Returns the graph diagram for this window */ + public GraphDiagram getDiag() { return td; } +} Property changes on: branches/gridsim4.0-branch3/source/eduni/simdiag/GraphWindow.java ___________________________________________________________________ Name: svn:executable + * Added: branches/gridsim4.0-branch3/source/eduni/simdiag/TimingDiagram.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simdiag/TimingDiagram.java (rev 0) +++ branches/gridsim4.0-branch3/source/eduni/simdiag/TimingDiagram.java 2007-09-14 07:33:33 UTC (rev 58) @@ -0,0 +1,806 @@ +/** + * TimingDiagram.java + * simjava timing diagram + * Adapted from a C++/Motif version + * 31 Jan 1998 - making it run in its own thread (so it + * doesn't need its own window). + */ + +package eduni.simdiag; + +import java.util.List; +import java.util.ArrayList; +import java.util.StringTokenizer; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Button; +import java.awt.Image; +import java.awt.Dimension; +import java.awt.Scrollbar; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.Frame; +import java.awt.Font; +import java.applet.Applet; +import java.awt.event.InputEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseListener; +import java.awt.event.AdjustmentListener; +import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; +import java.awt.event.AdjustmentEvent; + +class StringVector { + protected List v; + StringVector() { v = new ArrayList(); } + List getV() { return v; } + void add(String s) { v.add(s); } + String get( int i ) { return (String)v.get(i); } + int find( String s ) { + String found = null, curr; + int foundi = 0; + int v_size = v.size(); + for (int i=0; i < v_size; i++) { + curr = (String)v.get(i); + if(s.compareTo(curr) == 0) { + found = curr; + foundi = i; + } + } + return foundi; + } +} + +/** + * This class represents a data type to be displayed in + * The timing diagram. + * @version 1.0, June 1997 + * @author Fred Howell + */ +class TypeParam { + String typename; + protected StringVector labels; + TypeParam(String buff) { + labels = new StringVector(); + StringTokenizer st = new StringTokenizer(buff, " "); + typename = st.nextToken(); + while (st.hasMoreTokens()) + labels.add(st.nextToken()); + } + String getLabel(int i) { return labels.get(i); } + int get_index(String l) { return labels.find(l); } + + Color valtocol(int v) { + if (v==0) return Color.blue; + if (v==1) return Color.cyan; + if (v==2) return Color.darkGray; + if (v==3) return Color.gray; + if (v==4) return Color.green; + if (v==5) return Color.lightGray; + if (v==6) return Color.magenta; + if (v==7) return Color.orange; + if (v==8) return Color.pink; + if (v==9) return Color.red; + if (v==10) return Color.white; + return valtocol(v%10); + } + void drawKey(Graphics g, int x, int y, int w, int h) { + g.setColor(Color.black); + g.drawString(typename,x,y+h); + + // Draw blocks for labels too + String curr; + int blksize = 20; + List labelsV = labels.getV(); + int labelsV_size = labelsV.size(); + for (int i=0; i < labelsV_size; i++) { + int keywidth = w / (labelsV_size+1); + curr = (String)labelsV.get(i); + g.setColor(Color.black); + g.drawString(curr,x + (i+1)*keywidth, y+h); + g.setColor(valtocol(i)); + g.fillRect(x + (i+1)*keywidth, y , keywidth, h/2); + } + } +} + +class Types { + protected List types; + Types() { types = new ArrayList(); } + void add(TypeParam tp) { types.add(tp); } + TypeParam find( String s ) { + TypeParam found = null, curr; + int foundi = 0; + int types_size = types.size(); + for (int i=0; i < types_size; i++) { + curr = (TypeParam)types.get(i); + if(s.compareTo(curr.typename) == 0) { + found = curr; + } + } + return found; + } + void drawKeys(Graphics g, int w, int h) { + TypeParam curr; + int types_size = types.size(); + for (int i=0; i < types_size; i++) { + int keyheight = h / types_size; + curr = (TypeParam)types.get(i); + curr.drawKey(g,0,i * keyheight, w, (int)(keyheight*0.7)); + } + } + List getV() { return types; } +} + +class Event { + double time; + int stateno; + Event() { time = -1; stateno = 0; } + Event(double t, int s) { time = t; stateno = s; } + boolean isblank() { return (time==-1); } +} + + +/** + * This class represents an entry on the diagram + * including all data. + * @version 1.0, June 1997 + * @author Fred Howell + */ +class Entry { + + protected String name; + protected List events; + protected TypeParam tp; + int x,y,w,h; + double startt, endt; + + Entry(String n, TypeParam tp) { + name = n; + events = new ArrayList(); + this.tp = tp; + x = 0; y = 0; w = 100; h = 100; + } + + TypeParam getType() { return tp; } + void add(Event e) { events.add(e); } + void setPosition(int x, int y, int w, int h) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + } + + int ttox(double t ) { + return (int)((w) * (t-startt)/(endt-startt)); + } + + Color valtocol(int v) { + return tp.valtocol(v); + } + + void drawLabel(Graphics g, int x, int y) { + // Draw label + g.setColor(Color.black); + g.drawString(name,x,y); + } + + // draw all events from t1 to t2. + void draw(Graphics g, double t1, double t2) { + startt = t1; endt = t2; + + // System.out.println("Drawing from "+t1+" to "+t2); + + // Get last event before starttime + int ptri=0, previ=0; + boolean found = false; + int i=0; + for (i=0; i<events.size() && !found; i++) { + if (((Event)events.get(i)).time > t1) { + found = true; + ptri = i; + previ = ptri-1; if (previ<0) previ=0; + } + } + + // System.out.println("Found start at index "+previ+" out of "+events.size()); + + boolean reachedend = false; + for (; previ<events.size() && !reachedend; previ++) { + double time1=t1,time2=t2; + int val = 0; + + ptri = previ+1; + + Event prevevent = (Event)events.get(previ); + Event ptr; + if (ptri<events.size()) + ptr = (Event)events.get(ptri); + else ptr = new Event(); + + if (!prevevent.isblank()) { + time1 = prevevent.time; + val = prevevent.stateno; + } + if (!ptr.isblank()) time2 = ptr.time; + + if (time2 > t2) time2 = t2; + if (time1 > t2) time1 = t2; + + //System.out.println("Drawing: "+ttox(time1)+" "+ttox(time2-time1)+" v="+val+" t="+time1+" - "+time2); + + g.setColor(valtocol(val)); + g.fillRect(ttox(time1),y, ttox(time2)-ttox(time1),h); + + if (prevevent.time > t2) reachedend = true; + } + + } +} + + +/** + * This class loads and stores all data entries + * @version 1.0, June 1997 + * @author Fred Howell + */ + +class Entries { + protected List entries; + protected Types types; + + double starttime, endtime; + + Entries() { + entries = new ArrayList(); + types = new Types(); + starttime = 0.0; + endtime = 1.0; + } + + /* External commands */ + void reset() { + entries.clear(); + types.getV().clear(); + starttime = 0.0; + endtime = 1.0; + } + + /** Add a single trace line + * return 1 if successful + */ + final int TYPES = 0; + final int BARS = 1; + final int EVENTS = 2; + int section = TYPES; + int addTrace(String l) { + int success = 1; + if (l.startsWith("$")) { + // System.out.println("Changing section\n"); + if ("$types".compareTo(l) == 0) section = TYPES; + else if ("$bars".compareTo(l) == 0) section = BARS; + else if ("$events".compareTo(l) == 0) section = EVENTS; + else { + System.out.println("Couldn't read section name "+l); + success = 0; + } + } else if (section==TYPES) { + // Format: typename flag1 flag2 ... + types.add(new TypeParam(l)); + } else if (section==BARS) { + // Format: barname bartype + StringTokenizer st = new StringTokenizer(l); + String barname, bartype; + if (st.hasMoreTokens()) { + barname = st.nextToken(); + if (st.hasMoreTokens()) { + bartype = st.nextToken(); + TypeParam btp = types.find(bartype); + if (btp!=null) { + entries.add(new Entry(barname, btp)); + } else { + System.out.println("Couldn't find type "+bartype); + success = 0; + } + } + } + } else if (section==EVENTS) { + StringTokenizer st = new StringTokenizer(l, ": \n\r\t"); + if(st.nextToken().charAt(0) != 'u') + ;//System.out.println("Error: Only do 'u:' traces"); + else { + String barname = st.nextToken(); + Entry e = find(barname); + if (e==null) + ;// System.out.println("Couldn't find bar:"+barname); + else { + st.nextToken(); // skip 'at' + double timestamp = + (Double.valu... [truncated message content] |
From: <mar...@us...> - 2007-09-14 07:21:35
|
Revision: 57 http://gridsim.svn.sourceforge.net/gridsim/?rev=57&view=rev Author: marcos_dias Date: 2007-09-14 00:21:38 -0700 (Fri, 14 Sep 2007) Log Message: ----------- I have deleted the files to include GridSim Express. Removed Paths: ------------- branches/gridsim4.0-branch3/build.xml branches/gridsim4.0-branch3/examples/ branches/gridsim4.0-branch3/jars/ branches/gridsim4.0-branch3/javadoc.sh branches/gridsim4.0-branch3/source/ branches/gridsim4.0-branch3/testing/ Deleted: branches/gridsim4.0-branch3/build.xml =================================================================== --- branches/gridsim4.0-branch3/build.xml 2007-09-02 07:34:45 UTC (rev 56) +++ branches/gridsim4.0-branch3/build.xml 2007-09-14 07:21:38 UTC (rev 57) @@ -1,68 +0,0 @@ -<?xml version="1.0"?> - -<!-- September 2004 -Build file or Makefile for GridSim. -NOTE: Make sure you have installed 'ant' and put the location of it into - your path so you can access it anywhere. - 'ant' can be downloadable from http://ant.apache.org/ - -Usage: -* type 'ant' to compile all gridsim source files and put them into - classes/ directory -* type 'ant makejar' to compile the source files (if necessary) and to create - a jar file into jar/ directory - -NOTE: rule for javadoc is not included yet. Use javadoc.sh script instead under - Unix/Linux environment. - -Acknowledgement: Thank to Uros Cibej for providing this file and instruction on - how to use it. ---> - - -<project name="GridSim" basedir="." default="build"> - <description> - This is the build file for GridSim - </description> - - <!-- location to store Java classes --> - <property name="class.dir" location="./classes" /> - - <!-- location to store GridSim source files --> - <property name="src.dir" location="./source/gridsim" /> - - <!-- location to store jar files --> - <property name="jar.dir" location="./jars" /> - - <!-- location to store Javadoc files --> - <property name="doc.dir" location="./doc" /> - - <!-- location to use SimJava libraries --> - <property name="classpath" location="${jar.dir}/simjava2.jar" /> - - - - <target name="prepare"> - <mkdir dir="${class.dir}" /> - </target> - - <!-- rule to compile GridSim source files --> - <target name="build" depends="prepare"> - <javac srcdir="${src.dir}" destdir="${class.dir}" classpath="${classpath}" /> - </target> - - <!-- rule for making a jar file. - NOTE: - * The new jar file is named as "new_gridsim.jar" to avoid overriding - the existing jar file. - * The new jar file only contains gridsim classes NOT SimJava2. - --> - <target name="makejar" depends="build"> - <echo>Compiling a new jar file, named: "new_gridsim.jar".</echo> - <echo>This jar file only contains GridSim classes but not SimJava2.</echo> - <jar destfile="${jar.dir}/new_gridsim.jar" basedir="${class.dir}" /> - </target> - -</project> - - Deleted: branches/gridsim4.0-branch3/javadoc.sh =================================================================== --- branches/gridsim4.0-branch3/javadoc.sh 2007-09-02 07:34:45 UTC (rev 56) +++ branches/gridsim4.0-branch3/javadoc.sh 2007-09-14 07:21:38 UTC (rev 57) @@ -1,35 +0,0 @@ - -## A script to run javadoc (Anthony Sept 2004). - -year="2007" # year -ver="v4.0-branch1" # version number - -dir=./source # source directory that contains Java files -doc=./doc # output directory - -mkdir doc - -# Only creates GridSim javadoc. -javadoc -author -version -package -noqualifier java.* \ - -windowtitle 'GridSim '$ver' API Specification' \ - -doctitle '<b>GridSim</b> '$ver' API Specification' \ - -header '<b>GridSim</b><br><font size='-1'>'$ver'</font>' \ - -bottom 'The University of Melbourne, Australia, '$year \ - -d $doc -breakiterator \ - -tag pre:a:"Pre Condition:" \ - -tag post:a:"Post Condition:" \ - -tag invariant:t:"Invariant:" \ - $dir/gridsim/*.java \ - $dir/gridsim/util/*.java \ - $dir/gridsim/net/*.java \ - $dir/gridsim/filter/*.java \ - $dir/gridsim/index/*.java \ - $dir/gridsim/auction/*.java \ - $dir/gridsim/datagrid/*.java \ - $dir/gridsim/datagrid/filter/*.java \ - $dir/gridsim/datagrid/index/*.java \ - $dir/gridsim/datagrid/storage/*.java \ - $dir/gridsim/resFailure/*.java - -echo "javadoc is done ...." - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2007-09-02 07:34:44
|
Revision: 56 http://gridsim.svn.sourceforge.net/gridsim/?rev=56&view=rev Author: sulistio Date: 2007-09-02 00:34:45 -0700 (Sun, 02 Sep 2007) Log Message: ----------- add new descriptions to reflect the current status of branch1 Modified Paths: -------------- branches/README.txt Modified: branches/README.txt =================================================================== --- branches/README.txt 2007-09-02 07:20:14 UTC (rev 55) +++ branches/README.txt 2007-09-02 07:34:45 UTC (rev 56) @@ -53,6 +53,7 @@ comments. This includes any "@param" and "@return" tags. 7. check the repository regularly and definitely before you commit the changes. +When you commit, the code must at least report no compilation errors. Also, commit your changes frequently rather than one big batch at the end. Finally, put some descriptive comments when committing your changes. @@ -69,15 +70,22 @@ where Z is the GridSim version number used for this branch Y is the branch number -New additions to this branch must be listed in this file along with their -descriptions and authors' name. +A rule of thumb: a new branch is mainly used for developing 1 new feature or +functionality. However, a branch can have multiple authors or developers working. +This enables a faster release when this new feature is done, without the need +to wait for others in this branch to finish. +You never know how long each feature will take to complete. +Again, this depends on whether you want a new branch or not. +New branches must be listed in this file along with their +descriptions and authors or developers' name. + DIRECTORY STRUCTURE OF A NEW BRANCH Each branch needs to follow the below structure: -./examples -- storing all examples +./examples -- storing all examples related to this branch only. ./jars -- containing simjava2.jar. This is required by ant's build.xml ./source -- storing all GridSim code, including the new additions ./testing -- testing the new additions @@ -95,30 +103,25 @@ to prevent breaking the existing code. ------------------------------------------------------------------------- - Below is the current directory structure: ./branches/gridsim4.0-branch1/ - NOTE: This is a new branch based on GridSim v4.0 and created to incorporate a resource failure functionality. AUTHORS: Agustin Caminero and Anthony Sulistio -STATUS: INTEGRATING & TESTING - coding has finished but needs to integrate -with an existing code. Also testing needs to commence. +STATUS: COMPLETED -- released as GridSim Toolkit 4.1 on Sep 01, 2007. - +------------------------------------------------------------------------- ./branches/gridsim4.0-branch2/ - NOTE: This is a new branch based on GridSim v4.0 and created to incorporate a flow-level network functionality. AUTHORS: James Broberg STATUS: DESIGN & CODING - +------------------------------------------------------------------------- ./branches/gridsim4.0-branch3/ - -NOTE: -AUTHORS: -STATUS: - - +NOTE: This is a new branch based on GridSim v4.0 and created to incorporate + new extensions, such as background load, environment configuration, + service or provisioning, etc. +AUTHORS: Srikumar Venugopal and Marcos Assuncao +STATUS: INITIAL stage This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2007-09-02 07:20:13
|
Revision: 55 http://gridsim.svn.sourceforge.net/gridsim/?rev=55&view=rev Author: sulistio Date: 2007-09-02 00:20:14 -0700 (Sun, 02 Sep 2007) Log Message: ----------- add the gridsim jar of this release. Added Paths: ----------- tags/gridsimtoolkit-4.1/jars/gridsim.jar Added: tags/gridsimtoolkit-4.1/jars/gridsim.jar =================================================================== (Binary files differ) Property changes on: tags/gridsimtoolkit-4.1/jars/gridsim.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2007-09-02 07:12:42
|
Revision: 54 http://gridsim.svn.sourceforge.net/gridsim/?rev=54&view=rev Author: sulistio Date: 2007-09-02 00:12:39 -0700 (Sun, 02 Sep 2007) Log Message: ----------- Create a tag based on GridSim Toolkit 4.1 release Added Paths: ----------- tags/gridsimtoolkit-4.1/ Copied: tags/gridsimtoolkit-4.1 (from rev 53, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |