I'm working on Cloudsim Plus(simulation Tool) for a project work and I need to calculate the power consumption of each Virtual machine for implementing VM SELECTION ALGORITHM using MAXIMUM POWER REDUCTION POLICY.
The below code is a small portion of large code, written by me in PowerExample.java which is already available in clousimPlus examples folder. I have created four Virtual machines, two host and eight cloudlets.
Map<Double, Double> percent = v.getUtilizationHistory().getHistory();
System.out.println("Vm Id " + v.getId());
System.out.println("----------------------------------------");
for (Map.Entry<Double, Double> entry : percent.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
}
Output of the above code :-
Vm Id 0
----------------------------------------
10.0 1.0
20.0 1.0
30.0 1.0
40.0 1.0
50.0 1.0
60.0 0.5
70.0 0.5
80.0 0.5
90.0 0.5
99.0 0.5
100.0 0.5
100.21 0.0
Vm Id 1
----------------------------------------
10.0 1.0
20.0 1.0
30.0 1.0
40.0 1.0
50.0 1.0
60.0 0.5
70.0 0.5
80.0 0.5
90.0 0.5
99.0 0.5
100.0 0.5
100.21 0.0
Vm Id 2
----------------------------------------
10.0 1.0
20.0 1.0
30.0 1.0
40.0 1.0
50.0 1.0
60.0 0.5
70.0 0.5
80.0 0.5
90.0 0.5
99.0 0.5
100.0 0.5
100.21 0.0
Vm Id 3
----------------------------------------
10.0 1.0
20.0 1.0
30.0 1.0
40.0 1.0
50.0 1.0
60.0 0.5
70.0 0.5
80.0 0.5
90.0 0.5
99.0 0.5
100.0 0.5
100.21 0.0