-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlanetLabHelper.java
More file actions
73 lines (63 loc) · 2.12 KB
/
Copy pathPlanetLabHelper.java
File metadata and controls
73 lines (63 loc) · 2.12 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
package MyProject;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelNull;
import org.cloudbus.cloudsim.UtilizationModelPlanetLabInMemory;
/**
* A helper class for the running examples 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 PlanetLabHelper {
/**
* Creates the cloudlet list planet lab.
*
* @param brokerId the broker id
* @param inputFolderName the input folder name
* @return the list
* @throws FileNotFoundException the file not found exception
*/
public static List<Cloudlet> createCloudletListPlanetLab(int brokerId, String inputFolderName)
throws FileNotFoundException {
List<Cloudlet> list = new ArrayList<Cloudlet>();
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModelNull = new UtilizationModelNull();
File inputFolder = new File(inputFolderName);
File[] files = inputFolder.listFiles();
for (int i = 0; i < files.length; i++) {
Cloudlet cloudlet = null;
try {
cloudlet = new Cloudlet(
i,
Constants.CLOUDLET_LENGTH,
Constants.CLOUDLET_PES,
fileSize,
outputSize,
new UtilizationModelPlanetLabInMemory(
files[i].getAbsolutePath(),
Constants.SCHEDULING_INTERVAL), utilizationModelNull, utilizationModelNull);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
cloudlet.setUserId(brokerId);
cloudlet.setVmId(i);
list.add(cloudlet);
}
return list;
}
}