/** * Gets the total number of PMs. * * @return total number of machines the Datacenter has. */ public int getNumberOfHosts() { return getHostList().size(); }
/** * Gets a Machine with at least a given number of free Pe. * * @param peNumber the pe number * @return a Machine object or if not found * @pre $none * @post $none */ public Host getHostWithFreePe(int peNumber) { return HostList.getHostWithFreePe(getHostList(), peNumber); }
/** * Gets the first PM with at least one empty Pe. * * @return a Machine object or if not found * @pre $none * @post $none */ public Host getHostWithFreePe() { return HostList.getHostWithFreePe(getHostList()); }
/** * Gets the total number of <tt>FREE</tt> or non-busy PEs for all PMs. * * @return number of PEs * @pre $none * @post $result >= 0 */ public int getNumberOfFreePes() { return HostList.getNumberOfFreePes(getHostList()); }
/** * Gets the total number of PEs for all PMs. * * @return number of PEs * @pre $none * @post $result >= 0 */ public int getNumberOfPes() { return HostList.getNumberOfPes(getHostList()); }
/** * Gets the total number of <tt>BUSY</tt> PEs for all PMs. * * @return number of PEs * @pre $none * @post $result >= 0 */ public int getNumberOfBusyPes() { return HostList.getNumberOfBusyPes(getHostList()); }
/** * Gets the host list. * * @return the host list */ @SuppressWarnings("unchecked") public <T extends Host> List<T> getHostList() { return (List<T>) getCharacteristics().getHostList(); }
/** * Sets the particular Pe status on a PM. * * @param status Pe status, either <tt>Pe.FREE</tt> or <tt>Pe.BUSY</tt> * @param hostId Machine ID * @param peId Pe id * @return otherwise (Machine id or Pe id might not be exist) * @pre machineID >= 0 * @pre peID >= 0 * @post $none */ public boolean setPeStatus(int status, int hostId, int peId) { return HostList.setPeStatus(getHostList(), status, hostId, peId); }
/** * Gets the current number of failed PMs. * * @return current number of failed PMs the Datacenter has. */ public int getNumberOfFailedHosts() { int numberOfFailedHosts = 0; for (Host host : getHostList()) { if (host.isFailed()) { numberOfFailedHosts++; } } return numberOfFailedHosts; }
/** * Gets the Million Instructions Per Second (MIPS) Rating of the first Processing Element (Pe) * of the first PM. * <tt>NOTE:</tt>It is assumed all PEs' rating is same in a given machine. * * * @return the MIPS Rating or -1 if no PEs exists * * @pre $none * @post $result >= -1 * @todo It considers that all PEs of all PM have the same MIPS capacity, * what is not ensured because it is possible to add PMs of different configurations * to a datacenter. Even for the {@link Host} it is possible * to add Pe's of different capacities through the {@link Host#peList} attribute. */ public int getMipsOfOnePe() { if (getHostList().size() == 0) { return -1; } /*@todo Why is it always get the MIPS of the first host in the datacenter? The note in the method states that it is considered that all PEs into a PM have the same MIPS capacity, but different PM can have different PEs' MIPS.*/ return PeList.getMips(getHostList().get(0).getPeList(), 0); }
/** * Gets Millions Instructions Per Second (MIPS) Rating of a Processing Element (Pe). It is * essential to use this method when a datacenter is made up of heterogenous PEs per PMs. * * @param id the machine ID * @param peId the Pe ID * @return the MIPS Rating or -1 if no PEs are exists. * * @pre id >= 0 * @pre peID >= 0 * @post $result >= -1 * * @todo The id parameter would be renamed to pmId to be clear. */ public int getMipsOfOnePe(int id, int peId) { if (getHostList().size() == 0) { return -1; } return PeList.getMips(HostList.getById(getHostList(), id).getPeList(), peId); }
mips = getMipsOfOnePe() * HostList.getNumberOfPes(getHostList()); break; for (Host host : getHostList()) { mips += host.getTotalMips();
setSchedulingInterval(schedulingInterval); for (Host host : getCharacteristics().getHostList()) { host.setDatacenter(this);