/** * Prints a message about the progress of the simulation. * * @param message the message */ private static void printMessage(String message) { Log.printLine(message); }
/** * Prints the message passed as a non-String object and a new line. * * @param message the message */ public static void printLine(Object message) { if (!isDisabled()) { printLine(String.valueOf(message)); } }
/** * Prints a string formated as in String.format(), followed by a new line. * * @param format the format * @param args the args */ public static void formatLine(String format, Object... args) { if (!isDisabled()) { printLine(String.format(format, args)); } }
/** * Prints the concatenated text representation of the arguments and a new line. * * @param messages the messages to print */ public static void printConcatLine(Object... messages) { if (!isDisabled()) { buffer.setLength(0); // Clear the buffer for(int i = 0 ; i < messages.length ; i ++) { buffer.append(String.valueOf(messages[i])); } printLine(buffer); } }
/** * Initialise the simulation for stand alone simulations. This function should be called at the * start of the simulation. */ protected static void initialize() { Log.printLine("Initialising..."); entities = new ArrayList<SimEntity>(); entitiesByName = new LinkedHashMap<String, SimEntity>(); future = new FutureQueue(); deferred = new DeferredQueue(); waitPredicates = new HashMap<Integer, Predicate>(); clock = 0; running = false; }
/** * Prints the over utilized hosts. * * @param overUtilizedHosts the over utilized hosts */ protected void printOverUtilizedHosts(List<PowerContainerHostUtilizationHistory> overUtilizedHosts) { if (!Log.isDisabled()) { Log.printLine("Over-utilized hosts:"); for (PowerContainerHostUtilizationHistory host : overUtilizedHosts) { Log.printConcatLine("Host #", host.getId()); } Log.printLine(); } }
/** * Prints the over utilized hosts. * * @param overUtilizedHosts the over utilized hosts */ protected void printOverUtilizedHosts(List<PowerHostUtilizationHistory> overUtilizedHosts) { if (!Log.isDisabled()) { Log.printLine("Over-utilized hosts:"); for (PowerHostUtilizationHistory host : overUtilizedHosts) { Log.printConcatLine("Host #", host.getId()); } Log.printLine(); } }
/** * Returns PE capacity in MIPS. * * @return mips */ public double getPeCapacity() { if (getPeList() == null) { Log.printLine("Pe list is empty"); return 0; } return getPeList().get(0).getMips(); }
/** * Returns PE capacity in MIPS. * * @return mips */ public double getPeCapacity() { if (getPeList() == null) { Log.printLine("Pe list is empty"); return 0; } return getPeList().get(0).getMips(); }
/** * Returns PE capacity in MIPS. * * @return mips * @todo It considers that all PEs have the same capacity, * what has been shown doesn't be assured. The peList * received by the VmScheduler can be heterogeneous PEs. */ public double getPeCapacity() { if (getPeList() == null) { Log.printLine("Pe list is empty"); return 0; } return getPeList().get(0).getMips(); }
@Override public void startEntity() { Log.printLine(super.getName()+" is starting..."); schedule(getId(), 200, CREATE_BROKER); }
@Override protected void init(String inputFolder) { try { CloudSim.init(1, Calendar.getInstance(), false); broker = Helper.createBroker(); int brokerId = broker.getId(); cloudletList = PlanetLabHelper.createCloudletListPlanetLab(brokerId, inputFolder); vmList = Helper.createVmList(brokerId, cloudletList.size()); hostList = Helper.createHostList(PlanetLabConstants.NUMBER_OF_HOSTS); } catch (Exception e) { e.printStackTrace(); Log.printLine("The simulation has been terminated due to an unexpected error"); System.exit(0); } }
@Override protected void init(String inputFolder) { try { CloudSim.init(1, Calendar.getInstance(), false); broker = Helper.createBroker(); int brokerId = broker.getId(); cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); vmList = Helper.createVmList(brokerId, cloudletList.size()); hostList = Helper.createHostList(RandomConstants.NUMBER_OF_HOSTS); } catch (Exception e) { e.printStackTrace(); Log.printLine("The simulation has been terminated due to an unexpected error"); System.exit(0); } }
/** * Prints a list of debts generated on each of the simulated datacenters. * * @param datacentersList a list of datacenters. */ private void printDebts(List<PowerDatacenter> datacentersList) { Log.printLine(); Log.print("========== Datacenters' Debts ==========\n"); for(PowerDatacenter datacenter : datacentersList) { datacenter.printDebts(); Log.print("\n"); } }
@Override protected void init(String inputFolder, double overBookingFactor) { try { CloudSim.init(1, Calendar.getInstance(), false); // setOverBookingFactor(overBookingFactor); broker = HelperEx.createBroker(overBookingFactor); int brokerId = broker.getId(); cloudletList = HelperEx.createContainerCloudletList(brokerId, inputFolder, ConstantsExamples.NUMBER_CLOUDLETS); containerList = HelperEx.createContainerList(brokerId, ConstantsExamples.NUMBER_CLOUDLETS); vmList = HelperEx.createVmList(brokerId, ConstantsExamples.NUMBER_VMS); hostList = HelperEx.createHostList(ConstantsExamples.NUMBER_HOSTS); } catch (Exception e) { e.printStackTrace(); Log.printLine("The simulation has been terminated due to an unexpected error"); System.exit(0); } }
/** * Removes the migrating in vm. * * @param container the container */ public void removeMigratingInContainer(Container container) { containerDeallocate(container); getContainersMigratingIn().remove(container); getContainerList().remove(container); Log.printLine("ContainerVm# "+getId()+"removeMigratingInContainer:......" + container.getId() + " Is deleted from the list"); getContainerScheduler().getContainersMigratingIn().remove(container.getUid()); container.setInMigration(false); }
/** * Process non-default received events that aren't processed by * the {@link #processEvent(org.cloudbus.cloudsim.core.SimEvent)} method. * This method should be overridden by subclasses in other to process * new defined events. * * @param ev a SimEvent object * @pre ev != null * @post $none */ protected void processOtherEvent(SimEvent ev) { if (ev == null) { Log.printConcatLine("CloudInformationService.processOtherEvent(): ", "Unable to handle a request since the event is null."); return; } Log.printLine("CloudInformationSevice.processOtherEvent(): " + "Unable to handle a request from " + CloudSim.getEntityName(ev.getSource()) + " with event tag = " + ev.getTag()); }
/** * Gets the completed vms. * * @return the completed vms */ public int getNumberofContainers() { int numberofContainers = 0; for (ContainerVm containerVm : getVmList()) { numberofContainers += containerVm.getNumberOfContainers(); Log.print("The number of containers in VM# " + containerVm.getId()+"is: "+ containerVm.getNumberOfContainers()); Log.printLine(); } return numberofContainers; }
protected ContainerVm createVMinHost(ContainerHost host, boolean vmStatus) { for (int i=0; i<numberOfVmTypes; i++) { ContainerVm vm = getNewVm(i); if (getUtilizationOfCpuMips((PowerContainerHost) host) != 0 && isHostOverUtilizedAfterAllocation((PowerContainerHost) host, vm)) { continue; } if(allocateHostForVm(vm, host)){ Log.printLine("The vm ID #" + vm.getId() + "will be created "); vm.setInWaiting(vmStatus); return vm; } } return null; }
@Override public void processEvent(SimEvent ev) { switch (ev.getTag()) { case CREATE_BROKER: setBroker(createBroker(super.getName()+"_")); //Create VMs and Cloudlets and send them to broker setVmList(createVM(getBroker().getId(), 5, 100)); //creating 5 vms setCloudletList(createCloudlet(getBroker().getId(), 10, 100)); // creating 10 cloudlets broker.submitVmList(getVmList()); broker.submitCloudletList(getCloudletList()); CloudSim.resumeSimulation(); break; default: Log.printLine(getName() + ": unknown event type"); break; } }