From: <mar...@us...> - 2008-02-19 08:46:38
|
Revision: 114 http://gridsim.svn.sourceforge.net/gridsim/?rev=114&view=rev Author: marcos_dias Date: 2008-02-19 00:46:43 -0800 (Tue, 19 Feb 2008) Log Message: ----------- Inclusion of expected duration of a gridlet based on the runtime estimate. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/Gridlet.java branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/MPAvailabilityProfile.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/util/Workload.java Modified: branches/gridsim4.0-branch3/source/gridsim/Gridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/Gridlet.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/Gridlet.java 2008-02-19 08:46:43 UTC (rev 114) @@ -55,6 +55,11 @@ // the size of this Gridlet to be executed in a GridResource (unit: in MI) private double gridletLength_; + + // the expected size of this Gridlet to be executed in a GridResource + // (unit: in MI). This value is calculated based on the runtime estimate + // provided by the user. + private double expectedGridletLength_; // the input file size of this Gridlet before execution (unit: in byte) private long gridletFileSize_; // in byte = program + input data size @@ -196,6 +201,7 @@ this.num_ = null; this.history_ = null; this.newline_ = null; + this.expectedGridletLength_ = -1; // unknown } /** @@ -298,7 +304,29 @@ gridletLength_ = gridletLength; return true; } + + /** + * Sets the expected length or size (in MI) of this Gridlet + * to be executed in a GridResource based on the runtime estimate provided + * by the user. + * This Gridlet length is calculated for 1 PE only <tt>not</tt> the total + * length. + * + * @param gridletLength the length or size (in MI) of this Gridlet + * to be executed in a GridResource + * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise + * @pre gridletLength > 0 + * @post $none + */ + public boolean setExpectedGridletLength(double gridletLength) { + if (gridletLength <= 0) { + return false; + } + expectedGridletLength_ = gridletLength; + return true; + } + /** * Sets the network service level for sending this gridlet over a network * @param netServiceLevel determines the kind of service this gridlet @@ -873,6 +901,17 @@ } /** + * Gets the expected length of this Gridlet based on the runtime estimate + * @return the length of this Gridlet based on the user's runtime estimate + * @pre $none + * @post $result >= 0.0 + */ + public double getExpectedGridletLength() { + return expectedGridletLength_ > 0 ? + expectedGridletLength_ : gridletLength_; + } + + /** * Gets the total execution time of this Gridlet from the latest * GridResource * @return the total execution time of this Gridlet in a GridResource Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2008-02-19 08:46:43 UTC (rev 114) @@ -223,7 +223,7 @@ case AllocationAction.ITEM_SCHEDULED: for(ScheduleItem item : list){ - double finishTime = item.getFinishTime(); + double finishTime = item.getActualFinishTime(); settings_.setTimeSpan(finishTime); } pnItem_.updateItem(list.getLast()); @@ -762,7 +762,7 @@ int textHeight, textWidth; // gets the time duration of the gridlet - double duration = item.getFinishTime() - item.getStartTime(); + double duration = item.getActualFinishTime() - item.getStartTime(); width = (int) (duration * scaleX_); firstX = SHIFT_X + (int) (item.getStartTime() * scaleX_); @@ -838,7 +838,7 @@ int width, height; // gets the time duration of the gridlet - double duration = item.getFinishTime() - item.getStartTime(); + double duration = item.getActualFinishTime() - item.getStartTime(); width = (int) (duration * scaleX_); firstX = SHIFT_X + (int) (item.getStartTime() * scaleX_); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java 2008-02-19 08:46:43 UTC (rev 114) @@ -253,7 +253,7 @@ sgl.setPERangeList(selected); double resStartTime = sRes.getStartTime(); sgl.setStartTime(resStartTime); - sgl.setFinishTime(resStartTime + executionTime); + sgl.setActualFinishTime(resStartTime + executionTime); sgl.setStatus(Gridlet.QUEUED); queuedGridlets_.add(sgl); @@ -342,7 +342,7 @@ // if start time is 0, then it is an immediate reservation if(startTime == 0 || startTime == currentTime) { success = handleImmediateReservation(sRes); - expTime = sRes.getFinishTime(); + expTime = sRes.getActualFinishTime(); } else { success = handleAdvanceReservation(sRes); @@ -634,7 +634,7 @@ Iterator<SSReservation> iterRes = reservTable_.values().iterator(); while(iterRes.hasNext()) { SSReservation sRes = iterRes.next(); - if(sRes.getFinishTime() <= refTime) { + if(sRes.getActualFinishTime() <= refTime) { // Finish the reservation and include ranges in the // list of ranges to be released sRes.setStatus(Reservation.STATUS_FINISHED); @@ -681,7 +681,7 @@ startedReservations.add(sRes); - super.sendInternalEvent(sRes.getFinishTime()-refTime, + super.sendInternalEvent(sRes.getActualFinishTime()-refTime, CBParallelSpaceShared.UPDATE_SCHEDULE_TAG); numStartedRes++; @@ -1089,7 +1089,7 @@ // allocates the ranges and updates the availability profile profile_.allocatePERanges(queueId, anchorIndex, - tailIndex, selected, startTime, res.getFinishTime()); + tailIndex, selected, startTime, res.getActualFinishTime()); } else { Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-19 08:46:43 UTC (rev 114) @@ -278,11 +278,11 @@ // updates the availability profile accordingly allocateImmediatePERanges(tailIndex, selected, - currentTime, sRes.getFinishTime()); + currentTime, sRes.getActualFinishTime()); // the expiration time for immediate reservation is the // termination time - expTime = sRes.getFinishTime(); + expTime = sRes.getActualFinishTime(); } } // It is not an immediate reservation @@ -323,7 +323,7 @@ // allocates the ranges and updates the availability profile allocatePERanges(anchorIndex, tailIndex, selected, - startTime, sRes.getFinishTime()); + startTime, sRes.getActualFinishTime()); // calculate the expiration time of the reservation expTime = currentTime + commitPeriod_; @@ -414,7 +414,7 @@ " because it is already in the expiry list."); success = false; } - else if( (sRes = reservTable_.get(reservationId)).getFinishTime() <= currentTime ) { + else if( (sRes = reservTable_.get(reservationId)).getActualFinishTime() <= currentTime ) { System.out.println(super.get_name() + ".handleCancelReservation()" + " Reservation # " + reservationId + " cannot be cancelled because " + " it has already finished."); @@ -748,7 +748,7 @@ sgl.setPERangeList(selected); double resStartTime = sRes.getStartTime(); sgl.setStartTime(resStartTime); - sgl.setFinishTime(resStartTime + executionTime); + sgl.setActualFinishTime(resStartTime + executionTime); sgl.setStatus(Gridlet.QUEUED); queuedGridlets_.add(sgl); @@ -923,7 +923,7 @@ allocatedRanges.addAll(sRes.getPERangeList().clone()); startedReservations.add(sRes); - super.sendInternalEvent(sRes.getFinishTime()-refTime, + super.sendInternalEvent(sRes.getActualFinishTime()-refTime, CBParallelSpaceShared.UPDATE_SCHEDULE_TAG); numStartedRes++; @@ -971,7 +971,7 @@ Iterator<SSReservation> iterRes = reservTable_.values().iterator(); while(iterRes.hasNext()) { SSReservation sRes = iterRes.next(); - if(sRes.getFinishTime() <= refTime) { + if(sRes.getActualFinishTime() <= refTime) { // Finish the reservation and include ranges in the // list of ranges to be released sRes.setStatus(Reservation.STATUS_FINISHED); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java 2008-02-19 08:46:43 UTC (rev 114) @@ -155,7 +155,7 @@ // queue yet. It will probably be done shortly, // so just send a null to the user. if(sgl.getStatus() == Gridlet.SUCCESS || - sgl.getFinishTime() <= currentTime){ + sgl.getActualFinishTime() <= currentTime){ super.sendCancelGridlet(GridSimTags.GRIDLET_CANCEL, null, gridletId, userId); return; // return as it is impossible to cancel the Gridlet @@ -322,7 +322,7 @@ // change Gridlet status sgl.setStatus(Gridlet.QUEUED); sgl.setStartTime(startTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); //------------------ FOR DEBUGGING PURPOSES ONLY ---------------- @@ -354,7 +354,7 @@ // 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.getFinishTime() <= currentTime) { + if(gridlet.getActualFinishTime() <= currentTime) { gridletFinish(gridlet, Gridlet.SUCCESS); iter.remove(); itemsFinished++; @@ -386,7 +386,7 @@ // change Gridlet status gridlet.setStatus(Gridlet.INEXEC); - super.sendInternalEvent(gridlet.getFinishTime()-currentTime, + super.sendInternalEvent(gridlet.getActualFinishTime()-currentTime, UPDATE_SCHEDULE_TAG); } } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-19 08:46:43 UTC (rev 114) @@ -361,7 +361,7 @@ // queue yet. It will probably be done shortly, // so just send a null to the user. if(sgl.getStatus() == Gridlet.SUCCESS || - sgl.getFinishTime() <= currentTime){ + sgl.getActualFinishTime() <= currentTime){ super.sendCancelGridlet(GridSimTags.GRIDLET_CANCEL, null, gridletId, userId); return; // return as it is impossible to cancel the Gridlet @@ -559,7 +559,7 @@ double startTime = removedItem.getStartTime(); // the entries between reference time and endTime must be updated - double endTime = removedItem.getFinishTime(); + double endTime = removedItem.getActualFinishTime(); // if the Gridlet was running, then update the range of PEs currently // available and set the reference time as current simulation time @@ -646,7 +646,7 @@ // 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.getFinishTime() <= currentTime) { + if(gridlet.getActualFinishTime() <= currentTime) { // Update the list of ranges released if(!reserved) { releasedRanges.addAll(gridlet.getPERangeList().clone()); @@ -690,7 +690,7 @@ // change Gridlet status gridlet.setStatus(Gridlet.INEXEC); - super.sendInternalEvent(gridlet.getFinishTime()-currentTime, + super.sendInternalEvent(gridlet.getActualFinishTime()-currentTime, UPDATE_SCHEDULE_TAG); } } @@ -793,7 +793,7 @@ // add this Gridlet into execution list runningGridlets_.add(sgl); sgl.setStartTime(currentTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); // change Gridlet status sgl.setStatus(Gridlet.INEXEC); @@ -846,7 +846,7 @@ // change Gridlet status sgl.setStatus(Gridlet.QUEUED); sgl.setStartTime(startTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); } /** Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java 2008-02-19 08:46:43 UTC (rev 114) @@ -522,7 +522,7 @@ // add this Gridlet into execution list runningGridlets_.add(sgl); sgl.setStartTime(currentTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); // change Gridlet status sgl.setStatus(Gridlet.INEXEC); @@ -569,7 +569,7 @@ else { profile_.updateEntriesAtProfile(queue.pivot_); queue.pivot_.setStartTime(-1); - queue.pivot_.setFinishTime(-1); + queue.pivot_.setActualFinishTime(-1); queue.pivot_ = null; } } @@ -668,7 +668,7 @@ // change Gridlet status sgl.setStatus(Gridlet.QUEUED); sgl.setStartTime(startTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); //------------------ FOR DEBUGGING PURPOSES ONLY ---------------- @@ -770,7 +770,7 @@ // 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.getFinishTime() <= currentTime) { + if(gridlet.getActualFinishTime() <= currentTime) { gridletFinish(gridlet, Gridlet.SUCCESS); iter.remove(); itemsFinished++; @@ -802,7 +802,7 @@ // change Gridlet status queue.pivot_.setStatus(Gridlet.INEXEC); - super.sendInternalEvent(queue.pivot_.getFinishTime()-currentTime, + super.sendInternalEvent(queue.pivot_.getActualFinishTime()-currentTime, UPDATE_SCHEDULE_TAG); queue.pivot_ = null; } Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-19 08:46:43 UTC (rev 114) @@ -422,7 +422,7 @@ // add this Gridlet into execution list runningGridlets_.add(sgl); sgl.setStartTime(currentTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); // change Gridlet status sgl.setStatus(Gridlet.INEXEC); @@ -492,7 +492,7 @@ // changes the Gridlet status sgl.setStatus(Gridlet.QUEUED); sgl.setStartTime(startTime); - sgl.setFinishTime(finishTime); + sgl.setActualFinishTime(finishTime); pivot_ = sgl; //------------------ FOR DEBUGGING PURPOSES ONLY ---------------- @@ -631,7 +631,7 @@ // 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.getFinishTime() <= currentTime) { + if(gridlet.getActualFinishTime() <= currentTime) { // Update the list of ranges released gridletFinish(gridlet, Gridlet.SUCCESS); iter.remove(); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/MPAvailabilityProfile.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/MPAvailabilityProfile.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/MPAvailabilityProfile.java 2008-02-19 08:46:43 UTC (rev 114) @@ -909,7 +909,7 @@ double startTime = removedItem.getStartTime(); // the entries between reference time and endTime must be updated - double finishTime = removedItem.getFinishTime(); + double finishTime = removedItem.getActualFinishTime(); // transfer the PEs back to the queue transferPEs(partitionId, allocatedRanges, startTime, finishTime); Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2008-02-19 08:46:43 UTC (rev 114) @@ -43,9 +43,12 @@ // the time when the Gridlet is to start execution private double startTime_; - // estimation of Gridlet finished time - private double finishedTime_; + // the finish time of the Gridlet + private double actualFinishTime_; + // estimation of Gridlet finished time + private double expectedFinishTime_; + // num PE needed to execute this Gridlet private int numPE_; @@ -415,30 +418,56 @@ } /** - * Sets the finish time for this Gridlet. If time is negative, then it is - * being ignored. + * Sets the actual finish time for this Gridlet. That is, the time when + * the gridlet will finish. If time is negative, then it is being ignored. * @param time finish time * @pre time >= 0.0 * @post $none */ - public void setFinishTime(double time) { + public void setActualFinishTime(double time) { if (time < 0.0) { return; } - finishedTime_ = time; + actualFinishTime_ = time; } + + /** + * Sets the item's expected finish time. That is, this end + * time is based on the estimate provided by the user and may + * not reflect the actual finish time of the schedule item. + * @param time the expected finish time + * @pre time >= 0.0 + * @post $none + */ + public void setExpectedFinishTime(double time) { + if (time < 0.0) { + return; + } + expectedFinishTime_ = time; + } + /** * Gets the Gridlet's finish time * @return finish time of a gridlet or <tt>-1.0</tt> if * it cannot finish in this hourly slot - * @pre $none - * @post $result >= -1.0 */ - public double getFinishTime() { - return finishedTime_; + public double getActualFinishTime() { + return actualFinishTime_; } + + /** + * Gets the gridlet's expected finish time. That is, this end + * time is based on the estimate provided by the user and may + * not reflect the actual finish time of the schedule item. + * @return finish time of an item or equals to the actual + * finish time if not known. + */ + public double getExpectedFinishTime() { + return expectedFinishTime_ > 0 ? + expectedFinishTime_ : actualFinishTime_; + } /** * Gets this Gridlet object @@ -476,10 +505,11 @@ * for debugging purposes */ public String toString(){ - String result = "Gridlet {id=" + - getID() + ", start time=" + - startTime_ + ", finish time=" + - finishedTime_ + ", n. PEs=" + numPE_ + + String result = "Gridlet {id=" + getID() + + ", start time=" + startTime_ + + ", expected finish time=" + expectedFinishTime_ + + ", actual finish time=" + actualFinishTime_ + + ", n. PEs=" + numPE_ + ", ranges=" + peRangeList_ + "}"; return result; } @@ -501,9 +531,11 @@ " " + timeDescr + "\n" + "Start Time: " + decFormater_.format(convertTime(startTime_, timeUnit)) + " " + timeDescr + "\n" + - "FinishTime: " + decFormater_.format(convertTime(finishedTime_, timeUnit)) + + "Exp. Finish Time: " + decFormater_.format(convertTime(expectedFinishTime_, timeUnit)) + + " " + timeDescr + "\n" + + "Finish Time: " + decFormater_.format(convertTime(actualFinishTime_, timeUnit)) + " " + timeDescr + "\n" + - "Duration: " + decFormater_.format(convertTime(finishedTime_ - startTime_, timeUnit)) + + "Duration: " + decFormater_.format(convertTime(actualFinishTime_ - startTime_, timeUnit)) + " " + timeDescr + "\n" + "Length: " + decFormater_.format(gridlet_.getGridletLength()) + " MIs" + "\n" + "Num. PEs: " + numPE_; @@ -524,7 +556,8 @@ this.gridlet_.setSubmissionTime(arrivalTime_); // default values - this.finishedTime_ = NOT_FOUND; // Cannot finish in this hourly slot. + this.actualFinishTime_ = NOT_FOUND; // Cannot finish in this hourly slot. + this.expectedFinishTime_ = NOT_FOUND; this.startTime_ = NOT_FOUND; this.totalCompletionTime_ = 0.0; this.startExecTime_ = 0.0; Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2008-02-19 08:46:43 UTC (rev 114) @@ -312,7 +312,7 @@ * @pre $none * @post $none */ - public double getFinishTime() { + public double getActualFinishTime() { if(reservation_==null) return UNKNOWN; @@ -320,6 +320,17 @@ } /** + * Gets the reservation's expected finish time. That is, this end + * time is based on the estimate provided by the user.<br> + * <b>NOTE:</b> for advance reservations, the actual and expected finish + * times are the same. + * @return finish time of the advance reservation. + */ + public double getExpectedFinishTime() { + return getActualFinishTime(); + } + + /** * Gets this object's duration time in seconds * @return the reservation duration time in seconds * @pre $none @@ -399,7 +410,7 @@ " " + unitDesc + "\n" + "Start Time: " + decFormater_.format(convertTime(reservation_.getStartTime(), timeUnit)) + " " + unitDesc + "\n" + - "FinishTime: " + decFormater_.format(convertTime(getFinishTime(), timeUnit)) + + "FinishTime: " + decFormater_.format(convertTime(getActualFinishTime(), timeUnit)) + " " + unitDesc + "\n" + "Duration: " + decFormater_.format(convertTime(reservation_.getDurationTime(), timeUnit)) + " " + unitDesc + "\n" + Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2008-02-19 08:46:43 UTC (rev 114) @@ -66,13 +66,23 @@ double getStartTime(); /** - * Gets the item's finish time + * Gets the item's real finish time. That is, the actual + * time when the item is to finish * @return finish time of an item or <tt>-1.0</tt> if * not known */ - double getFinishTime(); + double getActualFinishTime(); /** + * Gets the item's expected finish time. That is, this end + * time is based on the estimate provided by the user and may + * not reflect the actual finish time of the schedule item. + * @return finish time of an item or equals to the actual + * finish time if not known. + */ + double getExpectedFinishTime(); + + /** * Gets the priority of this item assigned by the scheduler * @return the priority or <tt>-1</tt> if not found */ Modified: branches/gridsim4.0-branch3/source/gridsim/util/Workload.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/util/Workload.java 2008-02-19 02:42:56 UTC (rev 113) +++ branches/gridsim4.0-branch3/source/gridsim/util/Workload.java 2008-02-19 08:46:43 UTC (rev 114) @@ -660,8 +660,7 @@ if (JOB_NUM == IRRELEVANT) { id = gridletID_; } - else - { + else { obj = new Integer( array[JOB_NUM].trim() ); id = obj.intValue(); } @@ -670,18 +669,14 @@ Long l = new Long( array[SUBMIT_TIME].trim() ); long submitTime = l.intValue(); - // get the run time + // get the run time estimate obj = new Integer( array[REQ_RUN_TIME].trim() ); + int runTimeEstimate = obj.intValue(); + + // get the run time estimate + obj = new Integer( array[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) { @@ -710,7 +705,7 @@ } // submit a Gridlet - submitGridlet(id, submitTime, runTime, numProc); + submitGridlet(id, submitTime, runTime, runTimeEstimate, numProc); } catch (Exception e) { @@ -725,7 +720,8 @@ * resource * @param id a Gridlet ID * @param submitTime Gridlet's submit time - * @param runTime Gridlet's run time + * @param runTime Gridlet's actual run time + * @param runTimeEstimate Gridlet's run time estimate * @param numProc number of processors * @pre id >= 0 * @pre submitTime >= 0 @@ -733,13 +729,21 @@ * @pre numProc > 0 * @post $none */ - protected void submitGridlet(int id, long submitTime, int runTime, int numProc) + protected void submitGridlet(int id, long submitTime, int runTime, + int runTimeEstimate, int numProc) { // create the gridlet int len = runTime * rating_; // calculate a job length for each PE Gridlet gl = new Gridlet(id, len, size_, size_, GridSim.isTraceEnabled()); gl.setUserID( super.get_id() ); // set the owner ID gl.setNumPE(numProc); // set the requested num of proc + + // If runtime estimate was provided, then use it + if(runTimeEstimate != IRRELEVANT) { + // calculate ths job expected length for each PE + int expLen = runTimeEstimate * rating_; + gl.setExpectedGridletLength(expLen); + } // printing to inform user if (gridletID_ == 1 || gridletID_ % INTERVAL == 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |