-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlanetLabRunner.java
More file actions
104 lines (89 loc) · 3.03 KB
/
Copy pathPlanetLabRunner.java
File metadata and controls
104 lines (89 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package MyProject;
import java.util.Calendar;
import java.util.HashMap;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerHost;
import MyProject.LAutomata.Status;
/**
* The example runner for the PlanetLab workload.
*
* If you are using any algorithms, policies or workload included in the power
* package please cite the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic
* Algorithms and Adaptive Heuristics for Energy and Performance Efficient
* Dynamic Consolidation of Virtual Machines in Cloud Data Centers", Concurrency
* and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:
* 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
public class PlanetLabRunner extends RunnerAbstract {
public static HashMap<Integer, LAutomata> mapLAPlacement = new HashMap<Integer, LAutomata>();
public static HashMap<Integer, CALA> mapCALA = new HashMap<Integer, CALA>();
public static int NUMBER_OF_HOSTS = 100;
/**
* Instantiates a new planet lab runner.
*
* @param enableOutput
* the enable output
* @param outputToFile
* the output to file
* @param inputFolder
* the input folder
* @param outputFolder
* the output folder
* @param workload
* the workload
* @param vmAllocationPolicy
* the vm allocation policy
* @param vmSelectionPolicy
* the vm selection policy
* @param parameter
* the parameter
*/
public PlanetLabRunner(boolean enableOutput, boolean outputToFile,
String inputFolder, String outputFolder, String workload,
String vmAllocationPolicy, String vmSelectionPolicy) {
super(enableOutput, outputToFile, inputFolder, outputFolder, workload,
vmAllocationPolicy, vmSelectionPolicy);
}
/*
* (non-Javadoc)
*
* @see
* org.cloudbus.cloudsim.examples.power.RunnerAbstract#init(java.lang.String
* )
*/
@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());
Helper.hostList = Helper.createHostList(NUMBER_OF_HOSTS);
for (int hostID = 0; hostID < Helper.hostList.size(); hostID++) {
mapCALA.put(hostID, new CALA(.2, .6, .4));
mapLAPlacement.put(
hostID,
new LAutomata(false, .5, .5, .5, .5, .5, .5, .5, .5, 0,
.5, (Helper.hostList.get(hostID)
.getUtilizationOfCpu()), Status.IDLE));
}
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
public static int getNUMBER_OF_HOSTS() {
return NUMBER_OF_HOSTS;
}
public static void setNUMBER_OF_HOSTS(int number_of_hosts) {
NUMBER_OF_HOSTS = number_of_hosts;
}
}