|
6 | 6 | import org.cloudbus.cloudsim.container.core.*; |
7 | 7 | import org.cloudbus.cloudsim.container.resourceAllocatorMigrationEnabled.PowerContainerVmAllocationPolicyMigrationAbstract; |
8 | 8 | import org.cloudbus.cloudsim.container.utils.IDs; |
| 9 | +import org.cloudbus.cloudsim.core.HostEntity; |
9 | 10 | import org.cloudbus.cloudsim.power.PowerHost; |
10 | 11 | import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple; |
11 | 12 | import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; |
@@ -115,22 +116,22 @@ public static List<ContainerVm> createVmList(int brokerId, int containerVmsNumbe |
115 | 116 | } |
116 | 117 |
|
117 | 118 |
|
118 | | - public static List<Host> createHostList(int hostsNumber) { |
119 | | - ArrayList hostList = new ArrayList(); |
| 119 | + public static List<HostEntity> createHostList(int hostsNumber) { |
| 120 | + List<HostEntity> hostList = new ArrayList<>(); |
120 | 121 | for (int i = 0; i < hostsNumber; ++i) { |
121 | 122 | // int hostType = new RandomGen().getNum(ConstantsExamples.HOST_TYPES); |
122 | 123 | int hostType = i / (int) Math.ceil((double) hostsNumber / 3.0D); |
123 | 124 | // int hostType = i % 2; |
124 | 125 | // int hostType = 2; |
125 | | - ArrayList peList = new ArrayList(); |
| 126 | + List<Pe> peList = new ArrayList<>(); |
126 | 127 |
|
127 | 128 | for (int j = 0; j < ConstantsExamples.HOST_PES[hostType]; ++j) { |
128 | | - peList.add(new Pe(j, new PeProvisionerSimple((double) ConstantsExamples.HOST_MIPS[hostType]))); |
| 129 | + peList.add(new Pe(j, new PeProvisionerSimple(ConstantsExamples.HOST_MIPS[hostType]))); |
129 | 130 | } |
130 | 131 |
|
131 | 132 | // hostList.add(new PowerHost(i, new RamProvisionerSimple(ConstantsExamples.HOST_RAM[hostType]), |
132 | 133 | // new BwProvisionerSimple(1000000L), 1000000L, peList, new VmSchedulerTimeSharedOverSubscription(peList), ConstantsExamples.HOST_POWER[hostType])); |
133 | | - hostList.add(new PowerHost(IDs.pollId(Host.class), new RamProvisionerSimple(ConstantsExamples.HOST_RAM[hostType]), |
| 134 | + hostList.add(new PowerHost(IDs.pollId(HostEntity.class), new RamProvisionerSimple(ConstantsExamples.HOST_RAM[hostType]), |
134 | 135 | new BwProvisionerSimple(1000000L), 1000000L, peList, new VmSchedulerTimeSharedOverSubscription(peList), ConstantsExamples.HOST_POWER[hostType])); |
135 | 136 | } |
136 | 137 |
|
@@ -223,7 +224,7 @@ public static ContainerDatacenterBroker createBroker(double overBookingFactor) { |
223 | 224 | */ |
224 | 225 |
|
225 | 226 | public static ContainerDatacenter createDatacenter(String name, Class<? extends ContainerDatacenter> datacenterClass, |
226 | | - List<Host> hostList, |
| 227 | + List<HostEntity> hostList, |
227 | 228 | VmAllocationPolicy vmAllocationPolicy, |
228 | 229 | VmAllocationPolicy containerAllocationPolicy, |
229 | 230 | String experimentName, double schedulingInterval, String logAddress, double VMStartupDelay, |
@@ -263,7 +264,7 @@ public static void printResults( |
263 | 264 | boolean outputInCsv, |
264 | 265 | String outputFolder) { |
265 | 266 | Log.enable(); |
266 | | - List<Host> hosts = datacenter.getHostList(); |
| 267 | + List<HostEntity> hosts = datacenter.getHostList(); |
267 | 268 |
|
268 | 269 | int numberOfHosts = hosts.size(); |
269 | 270 | int numberOfVms = vms.size(); |
@@ -545,9 +546,9 @@ public static List<Double> getTimesBeforeContainerMigration(List<Container> cont |
545 | 546 | * @param hosts the hosts |
546 | 547 | * @return the times before host shutdown |
547 | 548 | */ |
548 | | - public static List<Double> getTimesBeforeHostShutdown(List<Host> hosts) { |
| 549 | + public static List<Double> getTimesBeforeHostShutdown(List<HostEntity> hosts) { |
549 | 550 | List<Double> timeBeforeShutdown = new LinkedList<>(); |
550 | | - for (Host host : hosts) { |
| 551 | + for (HostEntity host : hosts) { |
551 | 552 | boolean previousIsActive = true; |
552 | 553 | double lastTimeSwitchedOn = 0; |
553 | 554 | for (HostStateHistoryEntry entry : ((HostDynamicWorkload) host).getStateHistory()) { |
@@ -591,7 +592,7 @@ public static String parseExperimentName(String name) { |
591 | 592 | * @param hosts the hosts |
592 | 593 | * @return the sla time per active host |
593 | 594 | */ |
594 | | - protected static double getSlaTimePerActiveHost(List<Host> hosts) { |
| 595 | + protected static double getSlaTimePerActiveHost(List<HostEntity> hosts) { |
595 | 596 | double slaViolationTimePerHost = 0; |
596 | 597 | double totalTime = 0; |
597 | 598 |
|
@@ -627,7 +628,7 @@ protected static double getSlaTimePerActiveHost(List<Host> hosts) { |
627 | 628 | * @param hosts the hosts |
628 | 629 | * @return the sla time per host |
629 | 630 | */ |
630 | | - protected static double getSlaTimePerHost(List<Host> hosts) { |
| 631 | + protected static double getSlaTimePerHost(List<HostEntity> hosts) { |
631 | 632 | double slaViolationTimePerHost = 0; |
632 | 633 | double totalTime = 0; |
633 | 634 |
|
@@ -780,12 +781,12 @@ public static void writeDataRow(String data, String outputPath) { |
780 | 781 | * @param outputPath the output path |
781 | 782 | */ |
782 | 783 | public static void writeMetricHistory( |
783 | | - List<? extends Host> hosts, |
| 784 | + List<? extends HostEntity> hosts, |
784 | 785 | PowerContainerVmAllocationPolicyMigrationAbstract vmAllocationPolicy, |
785 | 786 | String outputPath) { |
786 | 787 | // for (Host host : hosts) { |
787 | 788 | for (int j = 0; j < 10; j++) { |
788 | | - Host host = hosts.get(j); |
| 789 | + HostEntity host = hosts.get(j); |
789 | 790 |
|
790 | 791 | if (!vmAllocationPolicy.getTimeHistory().containsKey(host.getId())) { |
791 | 792 | continue; |
@@ -825,10 +826,10 @@ public static void writeMetricHistory( |
825 | 826 | * @param vmAllocationPolicy the vm allocation policy |
826 | 827 | */ |
827 | 828 | public static void printMetricHistory( |
828 | | - List<? extends Host> hosts, |
| 829 | + List<? extends HostEntity> hosts, |
829 | 830 | PowerContainerVmAllocationPolicyMigrationAbstract vmAllocationPolicy) { |
830 | 831 | for (int i = 0; i < 10; i++) { |
831 | | - Host host = hosts.get(i); |
| 832 | + HostEntity host = hosts.get(i); |
832 | 833 |
|
833 | 834 | Log.println("Host #" + host.getId()); |
834 | 835 | Log.println("Time:"); |
@@ -861,7 +862,7 @@ public static void printResultsNew(PowerContainerDatacenter datacenter, |
861 | 862 | List<ContainerVm> vms = broker.getGuestsCreatedList(); |
862 | 863 | List<Container> containers = broker.getContainersCreatedList(); |
863 | 864 | Log.enable(); |
864 | | - List<Host> hosts = datacenter.getHostList(); |
| 865 | + List<HostEntity> hosts = datacenter.getHostList(); |
865 | 866 | Map<String, Double> slaMetrics = getSlaMetrics(vms); |
866 | 867 | String[] msg = { "ExperimentName","hostSelectionPolicy","vmAllocationPolicy", "OLThreshold","ULThreshold", "VMSPolicy","ContainerSpolicy","ContainerPlacement","Percentile", |
867 | 868 | "numberOfHosts", |
@@ -1096,10 +1097,10 @@ public static void printResultsNew(PowerContainerDatacenter datacenter, |
1096 | 1097 | } |
1097 | 1098 |
|
1098 | 1099 |
|
1099 | | - public static int getNumberofOverUtilization(List<? extends Host> hosts, |
| 1100 | + public static int getNumberofOverUtilization(List<? extends HostEntity> hosts, |
1100 | 1101 | PowerContainerVmAllocationPolicyMigrationAbstract vmAllocationPolicy) { |
1101 | 1102 | int numberOfOverUtilization = 0; |
1102 | | - for (Host host : hosts) { |
| 1103 | + for (HostEntity host : hosts) { |
1103 | 1104 | if (!vmAllocationPolicy.getTimeHistory().containsKey(host.getId())) { |
1104 | 1105 | continue; |
1105 | 1106 | } |
|
0 commit comments