From: <mar...@us...> - 2008-04-07 23:06:43
|
Revision: 167 http://gridsim.svn.sourceforge.net/gridsim/?rev=167&view=rev Author: marcos_dias Date: 2008-04-07 16:06:47 -0700 (Mon, 07 Apr 2008) Log Message: ----------- Small improvements in the java comments and some updates in getting free time slots from availability info objects. Modified Paths: -------------- branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java branches/gridsim4.0-branch3/source/gridsim/Accumulator.java branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/Machine.java branches/gridsim4.0-branch3/source/gridsim/MachineList.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/AREBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.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/CBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java branches/gridsim4.0-branch3/source/gridsim/turbo/QueuePartition.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/TResourceCharacteristics.java Added Paths: ----------- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlot.java Modified: branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Sim_entity.java 2008-04-07 23:06:47 UTC (rev 167) @@ -88,6 +88,7 @@ generators = new ArrayList(); // Add this to Sim_system automatically Sim_system.add(this); + super.setName(name); // sets the thread name to ease debugging } /** @@ -111,6 +112,7 @@ generators = new ArrayList(); // Add this to Sim_system automatically Sim_system.add(this); + super.setName(name); // sets the thread name to ease debugging } /** Modified: branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java =================================================================== --- branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/eduni/simjava/Sim_system.java 2008-04-07 23:06:47 UTC (rev 167) @@ -2,7 +2,6 @@ package eduni.simjava; -import java.text.NumberFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; Modified: branches/gridsim4.0-branch3/source/gridsim/Accumulator.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/Accumulator.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/Accumulator.java 2008-04-07 23:06:47 UTC (rev 167) @@ -93,43 +93,20 @@ /** * Calculates the mean of accumulated items - * @deprecated As of GridSim 2.1, replaced by {@link #getMean()} * @return the mean of accumalated items * @pre $none * @post $none */ - public double mean() { - return this.getMean(); - } - - /** - * Calculates the mean of accumulated items - * @return the mean of accumalated items - * @pre $none - * @post $none - */ public double getMean() { return mean_; } /** * Calculates the standard deviation of accumulated items - * @deprecated As of GridSim 2.1, replaced by - * {@link #getStandardDeviation()} * @return the Standard Deviation of accumulated items * @pre $none * @post $none */ - public double sd() { - return this.getStandardDeviation(); - } - - /** - * Calculates the standard deviation of accumulated items - * @return the Standard Deviation of accumulated items - * @pre $none - * @post $none - */ public double getStandardDeviation() { return Math.sqrt( this.getVariance() ); } @@ -146,105 +123,52 @@ /** * Finds the smallest number of accumulated items - * @deprecated As of GridSim 2.1, replaced by {@link #getMin()} * @return the smallest of accumulated items * @pre $none * @post $none */ - public double min() { - return this.getMin(); - } - - /** - * Finds the smallest number of accumulated items - * @return the smallest of accumulated items - * @pre $none - * @post $none - */ public double getMin() { return min_; } /** * Finds the largest number of accumulated items - * @deprecated As of GridSim 2.1, replaced by {@link #getMax()} * @return the largest of accumulated items * @pre $none * @post $none */ - public double max() { - return this.getMax(); - } - - /** - * Finds the largest number of accumulated items - * @return the largest of accumulated items - * @pre $none - * @post $none - */ public double getMax() { return max_; } /** * Finds the last accumulated item - * @deprecated As of GridSim 2.1, replaced by {@link #getLast()} * @return the last accumulated item * @pre $none * @post $none */ - public double last() { - return this.getLast(); - } - - /** - * Finds the last accumulated item - * @return the last accumulated item - * @pre $none - * @post $none - */ public double getLast() { return last_; } /** * Counts the number of items accumulated so far - * @deprecated As of GridSim 2.1, replaced by {@link #getCount()} * @return the number of items accumulated so far * @pre $none * @post $result >= 0 */ - public int count() { - return this.getCount(); - } - - /** - * Counts the number of items accumulated so far - * @return the number of items accumulated so far - * @pre $none - * @post $result >= 0 - */ public int getCount() { return n_; } /** * Calculates the sum of accumulated items - * @deprecated As of GridSim 2.1, replaced by {@link #getSum()} + * <b>NOTE:</b> The sum returned by this method is + * (number of items * mean of the accumulated items) * @return the sum of accumulated items * @pre $none * @post $none */ - public double sum() { - return this.getSum(); - } - - /** - * Calculates the sum of accumulated items - * @return the sum of accumulated items - * @pre $none - * @post $none - */ public double getSum() { return n_ * mean_; } @@ -252,20 +176,9 @@ /** * Determines the size of Accumulator object * @return the size of this object - * @deprecated As of GridSim 2.1, replaced by {@link #getByteSize()} * @pre $none * @post $result > 0 */ - public static int ByteSize() { - return getByteSize(); - } - - /** - * Determines the size of Accumulator object - * @return the size of this object - * @pre $none - * @post $result > 0 - */ public static int getByteSize() { int totalInt = 4; // contains only 1 int Modified: branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2008-04-07 23:06:47 UTC (rev 167) @@ -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/Machine.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/Machine.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/Machine.java 2008-04-07 23:06:47 UTC (rev 167) @@ -86,7 +86,7 @@ * @pre id >= 0 * @post $none */ - public int getMIPSRating(int peID){ + public int getMIPSRating(int peID) { return MIPSRatingPE_; } @@ -98,7 +98,7 @@ * @pre $none * @post $result >= 0 */ - public int getMIPSRating(){ + public int getMIPSRating() { return numPE_ * MIPSRatingPE_; } @@ -118,7 +118,7 @@ if (PEStatuses_[peID] == status) return false; - if(status){ + if(status) { busyPE_++; } else{ @@ -183,7 +183,7 @@ * Returns a list of free PEs * @return the list of free PEs */ - public LinkedList<Integer> getListFreePE(){ + public LinkedList<Integer> getListFreePE() { LinkedList<Integer> result = new LinkedList<Integer>(); for(int index=0; index<numPE_; index++){ if(!PEStatuses_[index]){ Modified: branches/gridsim4.0-branch3/source/gridsim/MachineList.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/MachineList.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/MachineList.java 2008-04-07 23:06:47 UTC (rev 167) @@ -74,7 +74,7 @@ * Returns the size of this list of machines * @return the size of the list */ - public int size(){ + public int size() { return map_.size(); } @@ -82,7 +82,7 @@ * Returns an iterator over the values in this list. * @return an iterator over the elements in this list. */ - public Iterator iterator(){ + public Iterator<Machine> iterator() { return map_.values().iterator(); } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java 2008-04-07 23:06:47 UTC (rev 167) @@ -26,7 +26,8 @@ * directed to these partitions using a partition predicate * ({@link QueuePartitionPredicate}. A partition can borrow resources from * another when it requires and the resources are not being used by the - * other partition. + * other partition. However, you can change this behaviour + * by calling {@link #setAllowBorrowing(boolean)}. * * We use an availability profile to store the availability of processing * elements. @@ -41,6 +42,9 @@ * <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.turbo.TAllocPolicy Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AREBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AREBMultiplePartitions.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AREBMultiplePartitions.java 2008-04-07 23:06:47 UTC (rev 167) @@ -25,8 +25,13 @@ * This policy can use multiple partitions or queues and the jobs can be * directed to these partitions using a partition predicate * ({@link QueuePartitionPredicate}. A partition can borrow resources from - * another when it requires and the resources are not being used by the - * other partition. + * another when it requires and the resources are not being used by the other + * partition. However, you can change this behaviour + * by calling {@link #setAllowBorrowing(boolean)}. Additionally, this policy + * supports priorities. Jobs are ordered according to their priorities; + * a high priority job can take the place of a pivot with lower priority. + * To change the way that the scheduler assigns priorities to the jobs, please + * see {@link PrioritySelector}. * * We use an availability profile to store the availability of processing * elements. In order to represent the pivots (i.e. the first jobs in the @@ -45,6 +50,9 @@ * <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.turbo.TAllocPolicy Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2008-04-07 23:06:47 UTC (rev 167) @@ -14,7 +14,6 @@ * and a resource providers to negotiate an advance reservation. * * @author Marcos Dias de Assuncao - * * @since GridSim Turbo Alpha 0.1 * * @see Reservation Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTGridResource.java 2008-04-07 23:06:47 UTC (rev 167) @@ -24,9 +24,10 @@ * {@link TResourceCharacteristics#AR_PARALLEL_SPACE_SHARED}. In addition, * a resource's scheduler should be extended from * {@link ARTPolicy} class. - * - * @author Marcos Dias de Assuncao - + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * * @see gridsim.GridResource * @see gridsim.GridSim * @see gridsim.ResourceCharacteristics Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfo.java 2008-04-07 23:06:47 UTC (rev 167) @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; +import java.util.LinkedList; /** * The {@link AvailabilityInfo} class represents a list of entries @@ -24,7 +25,7 @@ * @see PERange * @see PERangeList * @see ARParallelSpaceShared - * @see ARParallelSpaceShared#handleQueryAvailability(ARMessage) + * @see ARTPolicy#handleQueryAvailability(ARMessage) */ public class AvailabilityInfo extends ArrayList<AvailabilityInfoEntry> { @@ -384,11 +385,143 @@ } /** + * Returns the time slots contained in this availability information object + * within a specified period of time. <br> + * <b>NOTE:</b> The time slots returned by this method do not overlap. + * That is, they are not the scheduling options of a given job. + * @param startTime the start time of the period. + * @param finishTime the finish time of the period. + * @return a linked list with the time slots contained in this availability + * information object within a specified period of time. + */ + public LinkedList<TimeSlot> getTimeSlots(double startTime, double finishTime) { + LinkedList<TimeSlot> slots = new LinkedList<TimeSlot>(); + + // gets the part of the profile relevant to create the slots + AvailabilityInfo subProfile = getSubAvailabilityInfo(startTime, finishTime); + + if(subProfile == null || subProfile.size() == 0) + return slots; + + double slotStart = 0; + double slotFinish = 0; + int startIdx = 0; + int endIdx = 0; + AvailabilityInfoEntry entry = null; + AvailabilityInfoEntry nextEntry = null; + PERangeList rangesSlot = null; + PERangeList intersect = null; + + for(int i=0; i<subProfile.size(); i++) { + entry = subProfile.get(i); + slotStart = entry.getTime(); + startIdx = i; + endIdx = i; + + if(entry.getNumPE() == 0) + continue; + + // check all time slots starting at slotStart + do { + intersect = entry.getAvailRanges().clone(); + rangesSlot = intersect.clone(); + for(int j=i+1; j<subProfile.size(); j++) { + nextEntry = subProfile.get(j); + intersect = PERangeList.intersection(intersect, + nextEntry.getAvailRanges()); + + if(intersect != null && intersect.getNumPE() > 0) { + rangesSlot = intersect.clone(); + endIdx = j; + continue; + } + else + break; + } + + if(intersect != null && intersect.getNumPE() > 0) { + slotFinish = finishTime; + } + else { + slotFinish = nextEntry.getTime(); + } + + TimeSlot slot = new TimeSlot(slotStart, slotFinish, rangesSlot); + slots.add(slot); + + for(int j=startIdx; j<=endIdx; j++) { + nextEntry = subProfile.get(j); + PERangeList difference = + PERangeList.difference(nextEntry.getAvailRanges(), rangesSlot); + nextEntry.setAvailRanges(difference); + } + } while(entry.getNumPE() > 0); + } + + return slots; + } + + /** + * Returns part of the availability information.<br> + * <b>NOTE:</b> The entries of the sub-info are clones of the original + * info object's. + * @param startTime the start time of the resulting part + * @param finishTime the finish time of the resulting part + * @return part of the availability information. + */ + protected AvailabilityInfo getSubAvailabilityInfo(double startTime, double finishTime) { + AvailabilityInfo info = new AvailabilityInfo(); + + // start time cannot be smaller than the start time of the info obj + if(startTime < startTime_) + startTime = startTime_; + + // start time cannot be larger than the finish time of the info obj + if(startTime > finishTime_) { + return null; + } + + int length = super.size(); + AvailabilityInfoEntry entry = null; + AvailabilityInfoEntry firstEntry = null; + entry = getPrecedingEntry(startTime); + int index = super.indexOf(entry); + + firstEntry = entry.clone(startTime); + info.setStartTime(startTime); + info.add(firstEntry); + AvailabilityInfoEntry previousEntry = firstEntry; + + for(int i=index+1; i<length; i++) { + entry = super.get(i); + if(entry.getTime() <= startTime) + continue; + if(entry.getTime() > finishTime) { + break; + } + else { + PERangeList peList = entry.getAvailRanges(); + peList = (peList != null) ? peList.clone() : new PERangeList(); + + if( !previousEntry.getAvailRanges().equals(peList)) { + AvailabilityInfoEntry newEntry = entry.clone(entry.getTime()); + info.add(newEntry); + previousEntry = newEntry; + } + } + } + + info.setFinishTime(finishTime); + return info; + } + + /** * Creates a string representation of the list * @return a string representation */ public String toString() { - String result = "Availability={\n"; + String result = "Availability={startTime=" + startTime_ + + ", finishTime=" + finishTime_ + "\n"; for(AvailabilityInfoEntry entry : this){ result += entry + "\n"; } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityInfoEntry.java 2008-04-07 23:06:47 UTC (rev 167) @@ -107,6 +107,15 @@ } /** + * 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_; + } + + /** * Adds the ranges provided to the list of ranges available * @param list the list to be added * @return <tt>true</tt> if the ranges changed as result of this call Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfile.java 2008-04-07 23:06:47 UTC (rev 167) @@ -106,6 +106,39 @@ } /** + * Returns part of the availability profile.<br> + * <b>NOTE:</b> The entries of the sub-profile are clones of the original + * profile object's. + * @param startTime the start time of the resulting part + * @param finishTime the finish time of the resulting part + * @return part of the availability profile. + */ + protected AvailabilityProfile getSubProfile(double startTime, double finishTime) { + AvailabilityProfile subProfile = new AvailabilityProfile(); + AvailabilityProfileEntry previousEntry = null; + + for(AvailabilityProfileEntry entry : this) { + if(entry.getTime() < startTime) + continue; + if(entry.getTime() > finishTime) { + break; + } + else { + PERangeList peList = entry.getPERanges(); + peList = (peList != null) ? peList.clone() : new PERangeList(); + + if(previousEntry == null || !previousEntry.getPERanges().equals(peList)) { + AvailabilityProfileEntry newEntry = entry.clone(entry.getTime()); + subProfile.add(newEntry); + previousEntry = newEntry; + } + } + } + + return subProfile; + } + + /** * Creates an string representation of the profile * @return an string representation */ Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2008-04-07 23:06:47 UTC (rev 167) @@ -128,6 +128,19 @@ } /** + * Returns a clone of this entry. The ranges are cloned, but the time + * and the number of gridlets relying on this entry are not. + * @param time the time for the new entry + * @return the new entry with the number of gridlets set to default. + */ + public AvailabilityProfileEntry clone(double time) { + PERangeList ranges = ranges_ == null ? null : ranges_.clone(); + AvailabilityProfileEntry entry = + new AvailabilityProfileEntry(time, ranges); + return entry; + } + + /** * Creates a string representation of this entry */ public String toString() { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java 2008-04-07 23:06:47 UTC (rev 167) @@ -22,7 +22,8 @@ * multiple partitions or queues and the jobs can be directed to these partitions * using a partition predicate ({@link QueuePartitionPredicate}. A partition * can borrow resources from another when it requires and the resources are - * not being used by the other partition. + * not being used by the other partition. However, you can change this behaviour + * by calling {@link #setAllowBorrowing(boolean)}. * * We use an availability profile to store the availability of processing * elements. In order to represent the pivots (i.e. the first jobs in the @@ -42,6 +43,9 @@ * <li> This policy does not support advance reservations. * </ul> * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * * @see gridsim.GridSim * @see gridsim.ResourceCharacteristics * @see gridsim.turbo.TAllocPolicy Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java 2008-04-07 23:06:47 UTC (rev 167) @@ -28,8 +28,13 @@ * multiple partitions or queues and the jobs can be directed to these partitions * using a partition predicate ({@link QueuePartitionPredicate}. A partition * can borrow resources from another when it requires and the resources are - * not being used by the other partition. The implementation of this policy is - * based on the following paper: + * not being used by the other partition. However, you can change this behaviour + * by calling {@link #setAllowBorrowing(boolean)}. Additionally, this policy + * supports priorities. Jobs are ordered according to their priorities; + * a high priority job can take the place of a pivot with lower priority. + * To change the way that the scheduler assigns priorities to the jobs, please + * see {@link PrioritySelector}. The implementation of this policy is based + * on the following paper: * <p> * <ul> * <li> Barry G. Lawson and Evgenia Smirni, Multiple-Queue Backfilling Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java 2008-04-07 23:06:47 UTC (rev 167) @@ -13,8 +13,9 @@ /** * Class used to order the gridlets according to their * potential start times - * @author Marcos Dias de Assuncao - * + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 */ public class OrderGridletByStartTime implements Comparator<SSGridlet> { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java 2008-04-07 23:06:47 UTC (rev 167) @@ -14,9 +14,10 @@ * * @author Marcos Dias de Assuncao * @since GridSim Turbo Alpha 0.1 + * * @see PERangeList - * @see CBParallelSpaceShared - * @see EBParallelSpaceShared + * @see AvailabilityProfileEntry + * @see AvailabilityProfile */ public class PERange implements Cloneable, Comparable<PERange> { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/QueuePartition.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/QueuePartition.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/QueuePartition.java 2008-04-07 23:06:47 UTC (rev 167) @@ -3,6 +3,7 @@ /** * This class represents a partition in this scheduler. It only * stores a few variables used to control the partition. + * * @author Marcos Dias de Assuncao * @since GridSim Turbo Alpha 0.1 */ Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2008-04-07 23:06:47 UTC (rev 167) @@ -16,8 +16,8 @@ * and its properties. * * @author Marcos Dias de Assuncao - * * @since GridSim Turbo Alpha 0.1 + * * @invariant $none */ public class Reservation implements Cloneable, Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2008-04-07 23:06:47 UTC (rev 167) @@ -22,7 +22,6 @@ * and query. * * @author Marcos Dias de Assuncao - * * @since GridSim Turbo Alpha 0.1 */ public class ReservationRequester extends GridSim { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2008-03-31 00:27:24 UTC (rev 166) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2008-04-07 23:06:47 UTC (rev 167) @@ -241,7 +241,7 @@ * @param ranges the list of ranges available */ public void resetFreePERanges(PERangeList ranges) { - freePERanges_ = ranges == null ? null : ranges.clone(); // clones the list to avoid conflict + freePERanges_ = (ranges == null) ? null : ranges.clone(); // clones the list to avoid conflict } /** Added: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlot.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlot.java (rev 0) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlot.java 2008-04-07 23:06:47 UTC (rev 167) @@ -0,0 +1,120 @@ +/* + * 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; + +/** + * This class defines a time slot. A time slot can be used to represent a + * free fragment in the scheduling queue. This may be useful for users who + * want to implement policies that perform best-fit, next-fit or worst-fit + * time slot selection. For a description on how time slots can be utilised, + * please read the following paper on the MAUI scheduler: + * <ul> + * <li> David B. Jackson, Quinn Snell and Mark J. Clement. Core Algorithms + * of the Maui Scheduler, Revised Papers from the 7th International + * Workshop on Job Scheduling Strategies for Parallel Processing + * (JSSPP '01), Lecture Notes in Computer Science, pp. 87-102, London, UK. + * </ul> + * + * @author Marcos Dias de Assuncao + * @since GridSim Turbo Alpha 0.1 + * + * @see gridsim.turbo.PERange + * @see gridsim.turbo.PERangeList + */ +public class TimeSlot { + + private double startTime_; + private double finishTime_; + private PERangeList ranges_; + + /** + * Default constructor sets + * @param startTime the start time of the time slot + * @param finishTime the finish time of the time slot + * @param ranges the list of PE ranges available at the slot + */ + public TimeSlot(double startTime, double finishTime, PERangeList ranges) { + startTime_ = startTime; + finishTime_ = finishTime; + ranges_ = ranges; + } + + /** + * Sets the start time of the time slot + * @param startTime the start time + * @return <tt>true</tt> if set successfully; <tt>false</tt> otherwise. + * @pre startTime >= 0 + */ + public boolean setStartTime(double startTime) { + if(startTime <0) + return false; + + startTime_ = startTime; + return true; + } + + /** + * Sets the finish time of the time slot + * @param finishTime the finish time + * @return <tt>true</tt> if set successfully; <tt>false</tt> otherwise. + * @pre finishTime >= 0 + */ + public boolean setFinishTime(double finishTime) { + if(finishTime <0) + return false; + + finishTime_ = finishTime; + return true; + } + + /** + * Sets the ranges of the time slot + * @param ranges the ranges of this time slot + * @return <tt>true</tt> if set successfully; <tt>false</tt> otherwise. + * @pre ranges != <tt>null</tt> + */ + public boolean setPERanges(PERangeList ranges) { + if(ranges == null) + return false; + + ranges_ = ranges; + return true; + } + + /** + * Returns the start time of this time slot + * @return the start time of this time slot + */ + public double getStartTime() { + return startTime_; + } + + /** + * Returns the finish time of this time slot + * @return the finish time of this time slot + */ + public double getFinishTime() { + return finishTime_; + } + + /** + * Returns the PE ranges available at the time slot + * @return the PE ranges available at the time slot + */ + public PERangeList getPERanges() { + return ranges_; + } + + /** + * Returns the number of PEs available at the time slot + * @return the number of PEs available at the time slot + */ + public int getNumPE() { + return ranges_ == null ? 0 : ranges_.getNumPE(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |