本文整理汇总了Java中org.cloudbus.cloudsim.examples.power.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.cloudbus.cloudsim.examples.power包,在下文中一共展示了Constants类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.cloudbus.cloudsim.examples.power.Constants; //导入依赖的package包/类
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
String experimentName = "planetlab_npa";
String outputFolder = "output";
String inputFolder = NonPowerAware.class.getClassLoader().getResource("workload/planetlab/20110303")
.getPath();
Log.setDisabled(!Constants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = Helper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = PlanetLabHelper.createCloudletListPlanetLab(brokerId, inputFolder);
List<Vm> vmList = Helper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = Helper.createHostList(PlanetLabConstants.NUMBER_OF_HOSTS);
PowerDatacenterNonPowerAware datacenter = (PowerDatacenterNonPowerAware) Helper.createDatacenter(
"Datacenter",
PowerDatacenterNonPowerAware.class,
hostList,
new PowerVmAllocationPolicySimple(hostList));
datacenter.setDisableMigrations(true);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
CloudSim.terminateSimulation(Constants.SIMULATION_LIMIT);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
Helper.printResults(
datacenter,
vmList,
lastClock,
experimentName,
Constants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
System.exit(0);
}
Log.printLine("Finished " + experimentName);
}
示例2: PowerVmAllocationPolicyMigrationAbstract
import org.cloudbus.cloudsim.examples.power.Constants; //导入依赖的package包/类
/**
* Instantiates a new power vm allocation policy migration abstract.
*
* @param hostList the host list
* @param vmSelectionPolicy the vm selection policy
*/
public PowerVmAllocationPolicyMigrationAbstract(
List<? extends Host> hostList,
PowerVmSelectionPolicy vmSelectionPolicy) {
super(hostList);
setVmSelectionPolicy(vmSelectionPolicy);
setFindHostPolicy(Constants.findHostPolicy);
}
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:14,代码来源:PowerVmAllocationPolicyMigrationAbstract.java
示例3: createCloudletListPlanetLab
import org.cloudbus.cloudsim.examples.power.Constants; //导入依赖的package包/类
/**
* 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;
}
示例4: createCloudletList
import org.cloudbus.cloudsim.examples.power.Constants; //导入依赖的package包/类
/**
* Creates the cloudlet list.
*
* @param brokerId the broker id
* @param cloudletsNumber the cloudlets number
*
* @return the list< cloudlet>
*/
public static List<Cloudlet> createCloudletList(int brokerId, int cloudletsNumber) {
List<Cloudlet> list = new ArrayList<Cloudlet>();
long fileSize = 300;
long outputSize = 300;
long seed = RandomConstants.CLOUDLET_UTILIZATION_SEED;
UtilizationModel utilizationModelNull = new UtilizationModelNull();
for (int i = 0; i < cloudletsNumber; i++) {
Cloudlet cloudlet = null;
if (seed == -1) {
cloudlet = new Cloudlet(
i,
Constants.CLOUDLET_LENGTH,
Constants.CLOUDLET_PES,
fileSize,
outputSize,
new UtilizationModelStochastic(),
utilizationModelNull,
utilizationModelNull);
} else {
cloudlet = new Cloudlet(
i,
Constants.CLOUDLET_LENGTH,
Constants.CLOUDLET_PES,
fileSize,
outputSize,
new UtilizationModelStochastic(seed * i),
utilizationModelNull,
utilizationModelNull);
}
cloudlet.setUserId(brokerId);
cloudlet.setVmId(i);
list.add(cloudlet);
}
return list;
}
示例5: main
import org.cloudbus.cloudsim.examples.power.Constants; //导入依赖的package包/类
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
String experimentName = "random_npa";
String outputFolder = "output";
Log.setDisabled(!Constants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = Helper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(
brokerId,
RandomConstants.NUMBER_OF_VMS);
List<Vm> vmList = Helper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = Helper.createHostList(RandomConstants.NUMBER_OF_HOSTS);
PowerDatacenterNonPowerAware datacenter = (PowerDatacenterNonPowerAware) Helper.createDatacenter(
"Datacenter",
PowerDatacenterNonPowerAware.class,
hostList,
new PowerVmAllocationPolicySimple(hostList));
datacenter.setDisableMigrations(true);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
CloudSim.terminateSimulation(Constants.SIMULATION_LIMIT);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
Helper.printResults(
datacenter,
vmList,
lastClock,
experimentName,
Constants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
System.exit(0);
}
Log.printLine("Finished " + experimentName);
}