/** * Creates a fault injection mechanism for the Hosts of a given {@link Datacenter}. * The Hosts failures are randomly injected according to the given * pseudo random number generator, that indicates the mean of failures to be generated per <b>minute</b>, * (which is also called <b>event rate</b> or <b>rate parameter</b>). * * @param datacenter the Datacenter to which failures will be randomly injected for its Hosts * * @param faultArrivalHoursGenerator a Pseudo Random Number Generator which generates the * times Hosts failures will occur (in hours). * <b>The values returned by the generator will be considered to be hours</b>. * Frequently it is used a * {@link PoissonDistr} to generate failure arrivals, but any {@link ContinuousDistribution} * can be used. */ public HostFaultInjection(final Datacenter datacenter, final ContinuousDistribution faultArrivalHoursGenerator) { super(datacenter.getSimulation()); this.setDatacenter(datacenter); this.lastFailedHost = Host.NULL; this.faultArrivalHoursGenerator = faultArrivalHoursGenerator; this.random = new UniformDistr(faultArrivalHoursGenerator.getSeed()+1); this.vmRecoveryTimeSecsMap = new HashMap<>(); this.hostFaultsTimeSecsMap = new HashMap<>(); this.faultsOfAllVmsByBroker = new HashMap<>(); this.vmClonerMap = new HashMap<>(); this.maxTimeToFailInHours = Double.MAX_VALUE; }
private void runSimulationAndPrintResults() { simulation.start(); broker.getCloudletSubmittedList().sort(Comparator.comparingDouble(Cloudlet::getExecStartTime)); final CloudletsTableBuilder builder = new CloudletsTableBuilder(broker.getCloudletSubmittedList()); builder .column(9, this::formatColumn) .column(10, this::formatColumn) .column(11, this::formatColumn) .build(); final int notFinished = broker.getCloudletCreatedList().size() - broker.getCloudletFinishedList().size(); System.out.println("\nDatacenter Scheduling Interval: " + datacenter.getSchedulingInterval()); System.out.println("Min time between events: " + simulation.getMinTimeBetweenEvents()); System.out.println("Seed for the random Cloudlet's submission delay generator: " + random.getSeed() + "\n"); System.out.println("Cloudlets created: " +cloudletList.size() + " | Cloudlets not finished: " + notFinished); if(notFinished > 0){ System.out.println("\n----------> Try decreasing the value of MIN_TIME_BETWEEN_EVENTS constant in this example! <----------\n"); } System.out.println(getClass().getSimpleName() + " finished!"); }