cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-testbeds/src/main/java/org/cloudsimplus/hostfaultinjection/HostFaultInjectionExperiment.java
public static void main(String[] args) throws FileNotFoundException, IOException {
        HostFaultInjectionExperiment exp = new HostFaultInjectionExperiment(System.currentTimeMillis());

        exp.setVerbose(true).run();
        exp.getBrokerList().stream().forEach(b -> System.out.printf("%s - Availability %%: %.4f\n", b, exp.getFaultInjection().availability(b) * 100));

        System.out.println("Percentage of Brokers meeting the Availability Metric in SLA: " + exp.getPercentageOfAvailabilityMeetingSla() * 100);
        System.out.println("# Ratio VMS per HOST: " + exp.getRatioVmsPerHost());
        System.out.println("\n# Number of Host faults: " + exp.getFaultInjection().getNumberOfHostFaults());
        System.out.println("# Number of VM faults (VMs destroyed): " + exp.getFaultInjection().getNumberOfFaults());
        System.out.printf("# VMs MTBF average: %.2f minutes\n", exp.getFaultInjection().meanTimeBetweenVmFaultsInMinutes());
        Log.printFormattedLine("# Time the simulations finished: %.2f minutes", exp.getCloudSim().clockInMinutes());
        Log.printFormattedLine("# Hosts MTBF: %.2f minutes", exp.getFaultInjection().meanTimeBetweenHostFaultsInMinutes());
        Log.printFormattedLine("\n# If the hosts are showing in the result equal to 0, it was because the vms ended before the failure was set.\n");
    }
/**
     * A main method just for test purposes.
     *
     * @param args
     * @throws FileNotFoundException
     * @throws IOException
     */
A main method just for test purposes.
A main method just for test purposes .
public static void main(String[] args) throws FileNotFoundException, IOException {
        HostFaultInjectionExperiment exp = new HostFaultInjectionExperiment(System.currentTimeMillis());
        exp.setVerbose(true).run();
        exp.getBrokerList().stream().forEach(b -> System.out.printf("%s - Availability %%: %.4f\n", b, exp.getFaultInjection().availability(b) * 100));
        System.out.println("Percentage of Brokers meeting the Availability Metric in SLA: " + exp.getPercentageOfAvailabilityMeetingSla() * 100);
        System.out.println("# Ratio VMS per HOST: " + exp.getRatioVmsPerHost());
        System.out.println("\n# Number of Host faults: " + exp.getFaultInjection().getNumberOfHostFaults());
        System.out.println("# Number of VM faults (VMs destroyed): " + exp.getFaultInjection().getNumberOfFaults());
        System.out.printf("# VMs MTBF average: %.2f minutes\n", exp.getFaultInjection().meanTimeBetweenVmFaultsInMinutes());
        Log.printFormattedLine("# Time the simulations finished: %.2f minutes", exp.getCloudSim().clockInMinutes());
        Log.printFormattedLine("# Hosts MTBF: %.2f minutes", exp.getFaultInjection().meanTimeBetweenHostFaultsInMinutes());
        Log.printFormattedLine("\n# If the hosts are showing in the result equal to 0, it was because the vms ended before the failure was set.\n");
    }
public static void main ( String [ ] args ) throws FileNotFoundException , IOException { HostFaultInjectionExperiment exp = new HostFaultInjectionExperiment ( System . currentTimeMillis ( ) ) ; exp . setVerbose ( true ) . run ( ) ; exp . getBrokerList ( ) . stream ( ) . forEach ( b -> System . out . printf ( "%s - Availability %%: %.4f\n" , b , exp . getFaultInjection ( ) . availability ( b ) * 100 ) ) ; System . out . println ( "Percentage of Brokers meeting the Availability Metric in SLA: " + exp . getPercentageOfAvailabilityMeetingSla ( ) * 100 ) ; System . out . println ( "# Ratio VMS per HOST: " + exp . getRatioVmsPerHost ( ) ) ; System . out . println ( "\n# Number of Host faults: " + exp . getFaultInjection ( ) . getNumberOfHostFaults ( ) ) ; System . out . println ( "# Number of VM faults (VMs destroyed): " + exp . getFaultInjection ( ) . getNumberOfFaults ( ) ) ; System . out . printf ( "# VMs MTBF average: %.2f minutes\n" , exp . getFaultInjection ( ) . meanTimeBetweenVmFaultsInMinutes ( ) ) ; Log . printFormattedLine ( "# Time the simulations finished: %.2f minutes" , exp . getCloudSim ( ) . clockInMinutes ( ) ) ; Log . printFormattedLine ( "# Hosts MTBF: %.2f minutes" , exp . getFaultInjection ( ) . meanTimeBetweenHostFaultsInMinutes ( ) ) ; Log . printFormattedLine ( "\n# If the hosts are showing in the result equal to 0, it was because the vms ended before the failure was set.\n" ) ; }
A main method just for test purposes.
A main method just for test purposes .