⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resgridlet.java

📁 一个非常著名的网格模拟器,能够运行网格调度算法!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    public void setMachineAndPEID(int machineID, int peID)    {        // if this job only requires 1 PE        this.machineID_ = machineID;        this.peID_ = peID;                // if this job requires many PEs        if (this.peArrayID_ != null && this.numPE_ > 1)        {            this.machineArrayID_[index_] = machineID;            this.peArrayID_[index_] = peID;            index_++;        }    }    /**     * Gets machine ID     * @return machine ID or <tt>-1</tt> if it is not specified before     * @deprecated As of GridSim 2.1, replaced by {@link #getMachineID()}     * @pre $none     * @post $result >= -1     */    public int GetMachineID() {        return this.getMachineID();    }    /**     * Gets machine ID     * @return machine ID or <tt>-1</tt> if it is not specified before     * @pre $none     * @post $result >= -1     */    public int getMachineID() {        return machineID_;    }    /**     * Gets PE ID     * @return PE ID or <tt>-1</tt> if it is not specified before     * @deprecated As of GridSim 2.1, replaced by {@link #getPEID()}     * @pre $none     * @post $result >= -1     */    public int GetPEID() {        return this.getPEID();    }    /**     * Gets PE ID     * @return PE ID or <tt>-1</tt> if it is not specified before     * @pre $none     * @post $result >= -1     */    public int getPEID() {        return peID_;    }    /**     * Gets a list of PE IDs. <br>     * NOTE: To get the machine IDs corresponding to these PE IDs, use     * {@link #getListMachineID()}.     *     * @return an array containing PE IDs.     * @pre $none     * @post $none     */    public int[] getListPEID() {        return peArrayID_;    }    /**     * Gets a list of Machine IDs. <br>     * NOTE: To get the PE IDs corresponding to these machine IDs, use     * {@link #getListPEID()}.     *     * @return an array containing Machine IDs.     * @pre $none     * @post $none     */    public int[] getListMachineID() {        return machineArrayID_;    }    /**     * Gets the remaining gridlet length     * @return gridlet length     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getRemainingGridletLength()}     * @pre $none     * @post $result >= 0     */    public double GetRemainingLength() {        return this.getRemainingGridletLength();    }    /**     * Gets the remaining gridlet length     * @return gridlet length     * @pre $none     * @post $result >= 0     */    public double getRemainingGridletLength()    {        double length = gridlet_.getGridletLength() - gridletFinishedSoFar_;        // Remaining Gridlet length can't be negative number. This can be        // happening when this.updateGridletFinishedSoFar() keep calling.        if (length < 0.0) {            length = 0.0;        }        return length;    }    /**     * Finalizes all relevant information before <tt>exiting</tt> the     * GridResource entity. This method sets the final data of:     * <ul>     *     <li> wall clock time, i.e. the time of this Gridlet resides in     *          a GridResource (from arrival time until departure time).     *     <li> actual CPU time, i.e. the total execution time of this     *          Gridlet in a GridResource.     *     <li> Gridlet's finished so far     * </ul>     * @pre $none     * @post $none     */    public void finalizeGridlet()    {        // Sets the wall clock time and actual CPU time        double wallClockTime = GridSim.clock() - arrivalTime_;        gridlet_.setExecParam(wallClockTime, totalCompletionTime_);        double finished = 0.0;        if (gridlet_.getGridletLength() < gridletFinishedSoFar_) {            finished = gridlet_.getGridletLength();        }        else {            finished = gridletFinishedSoFar_;        }        gridlet_.setGridletFinishedSoFar(finished);    }    /**     * A method that updates the length of gridlet that has been completed     * @param miLength gridlet length in Million Instructions (MI)     * @deprecated As of GridSim 2.1, replaced by     *             {@link #updateGridletFinishedSoFar(double)}     * @pre miLength >= 0.0     * @post $none     */    public void UpdateGridletFinishedSoFar(double miLength) {        this.updateGridletFinishedSoFar(miLength);    }    /**     * A method that updates the length of gridlet that has been completed     * @param miLength gridlet length in Million Instructions (MI)     * @pre miLength >= 0.0     * @post $none     */    public void updateGridletFinishedSoFar(double miLength) {        gridletFinishedSoFar_ += miLength;    }    /**     * Gets arrival time of a gridlet     * @return arrival time     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getGridletArrivalTime()}     * @pre $none     * @post $result >= 0.0     */    public double GetArrivalTime() {        return this.getGridletArrivalTime();    }    /**     * Gets arrival time of a gridlet     * @return arrival time     * @pre $none     * @post $result >= 0.0     */    public double getGridletArrivalTime() {        return arrivalTime_;    }    /**     * Determines time by which this Gridlet can finish.     * <br>     * <b>NOTE:</b> To be used by Time shared resources only.     * @param availableRating  the available MIPS considering current hour     *                         load     * @param rCalendar        Resourcce Calendar     * @throws NullPointerException  if ResourceCalendar object is <tt>null</tt>     * @deprecated As of GridSim 2.2, replaced by     *             {@link #setFinishTime(double)}. This method is     *             <b>OBSOLETE</b> since it is the responsibility of individual     *             scheduling to come up with the finish time for each Gridlet.     * @deprecated As of GridSim 2.1, replaced by     *             {@link #setFinishTimeForTimeSharedResource(double,     *             ResourceCalendar)}     * @pre availableRating > 0.0     * @pre rCalendar != null     * @post $none     */    public void SetFinishTimeForTimeSharedResource(double availableRating,                    ResourceCalendar rCalendar) throws NullPointerException    {        this.setFinishTimeForTimeSharedResource(availableRating, rCalendar);    }    /**     * Determines time by which this Gridlet can finish.     * <br>     * <b>NOTE:</b> To be used by Time shared resources only.     * @param availableRating  the available MIPS considering current hour     *                         load     * @param rCalendar        Resourcce Calendar     * @throws NullPointerException  if ResourceCalendar object is <tt>null</tt>     * @deprecated As of GridSim 2.2, replaced by     *             {@link #setFinishTime(double)}. This method is     *             <b>OBSOLETE</b> since it is the responsibility of individual     *             scheduling to come up with the finish time for each Gridlet.     * @pre availableRating > 0.0     * @pre rCalendar != null     * @post $none     */    public void setFinishTimeForTimeSharedResource(double availableRating,                    ResourceCalendar rCalendar) throws NullPointerException    {        // ... obsolete method    }    /**     * Determines time by which this Gridlet can finish.     * <br>     * <b>NOTE:</b> To be used by Space shared resources only.     * @param availableRating  this is 100% availability of PE MIPS since     *                         it runs in dedicated mode     * @deprecated As of GridSim 2.2, replaced by     *             {@link #setFinishTime(double)}. This method is     *             <b>OBSOLETE</b> since it is the responsibility of individual     *             scheduling to come up with the finish time for each Gridlet.     * @deprecated As of GridSim 2.1, replaced by     *             {@link #setFinishTimeForSpaceSharedResource(double)}     * @pre availableRating > 0.0     * @post $none     */    public void SetFinishTimeForSpaceSharedResource(double availableRating)    {        this.setFinishTimeForSpaceSharedResource(availableRating);    }    /**     * Determines time by which this Gridlet can finish.     * <br>     * <b>NOTE:</b> To be used by Space shared resources only.     * @param availableRating  this is 100% availability of PE MIPS since     *                         it runs in dedicated mode     * @deprecated As of GridSim 2.2, replaced by     *             {@link #setFinishTime(double)}. This method is     *             <b>OBSOLETE</b> since it is the responsibility of individual     *             scheduling to come up with the finish time for each Gridlet.     * @pre availableRating > 0.0     * @post $none     */    public void setFinishTimeForSpaceSharedResource(double availableRating)    {        // ... obsolete method    }    /**     * Sets the finish time for this Gridlet. If time is negative, then it is     * being ignored.     * @param time   finish time     * @pre time >= 0.0     * @post $none     */    public void setFinishTime(double time)    {        if (time < 0.0) {            return;        }        finishedTime_ = 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     * @deprecated As of GridSim 2.1, replaced by     *             {@link #getGridletFinishTime()}     * @pre $none     * @post $result >= -1.0     */    public double GetFinishTime() {        return this.getGridletFinishTime();    }    /**     * 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 getGridletFinishTime() {        return finishedTime_;    }    /**     * Gets this Gridlet object     * @return gridlet object     * @deprecated As of GridSim 2.1, replaced by {@link #getGridlet()}     * @pre $none     * @post $result != null     */    public Gridlet GetGridlet() {        return this.getGridlet();    }    /**     * Gets this Gridlet object     * @return gridlet object     * @pre $none     * @post $result != null     */    public Gridlet getGridlet() {        return gridlet_;    }    /**     * Gets the Gridlet status     * @return Gridlet status     * @pre $none     * @post $none     */    public int getGridletStatus() {        return gridlet_.getGridletStatus();    }} // end class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -