本文整理汇总了Java中org.cloudbus.cloudsim.VmAllocationPolicy类的典型用法代码示例。如果您正苦于以下问题:Java VmAllocationPolicy类的具体用法?Java VmAllocationPolicy怎么用?Java VmAllocationPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VmAllocationPolicy类属于org.cloudbus.cloudsim包,在下文中一共展示了VmAllocationPolicy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PowerDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
/**
* Instantiates a new datacenter.
*
* @param name the name
* @param characteristics the res config
* @param schedulingInterval the scheduling interval
* @param utilizationBound the utilization bound
* @param vmAllocationPolicy the vm provisioner
* @param storageList the storage list
* @throws Exception the exception
*/
public PowerDatacenter(
String name,
DatacenterCharacteristics characteristics,
VmAllocationPolicy vmAllocationPolicy,
List<Storage> storageList,
double schedulingInterval) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
setPower(0.0);
setDisableMigrations(false);
setCloudletSubmitted(-1);
setMigrationCount(0);
}
示例2: createSDNDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
protected static SDNDatacenter createSDNDatacenter(String name, String physicalTopology, NetworkOperatingSystem snos, VmAllocationPolicyFactory vmAllocationFactory) {
// In order to get Host information, pre-create NOS.
nos=snos;
List<Host> hostList = nos.getHostList();
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this
// resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); // we are not adding SAN
// devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
// Create Datacenter with previously set parameters
SDNDatacenter datacenter = null;
try {
VmAllocationPolicy vmPolicy = vmAllocationFactory.create(hostList);
maxHostHandler = (PowerUtilizationMaxHostInterface)vmPolicy;
datacenter = new SDNDatacenter(name, characteristics, vmPolicy, storageList, 0, nos);
nos.setDatacenter(datacenter);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
示例3: SDNDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public SDNDatacenter(String name, DatacenterCharacteristics characteristics, VmAllocationPolicy vmAllocationPolicy, List<Storage> storageList, double schedulingInterval, NetworkOperatingSystem nos) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
this.nos=nos;
this.requestsTable = new HashMap<Integer, Request>();
//nos.init();
}
示例4: updateVmMonitor
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
private void updateVmMonitor(double logTime) {
VmAllocationPolicy vmAlloc = datacenter.getVmAllocationPolicy();
if(vmAlloc instanceof OverbookingVmAllocationPolicy) {
for(Vm v: this.vmList) {
SDNVm vm = (SDNVm)v;
double mipsOBR = ((OverbookingVmAllocationPolicy)vmAlloc).getCurrentOverbookingRatioMips((SDNVm) vm);
LogWriter log = LogWriter.getLogger("vm_OBR_mips.csv");
log.printLine(vm.getName()+","+logTime+","+mipsOBR);
double bwOBR = ((OverbookingVmAllocationPolicy)vmAlloc).getCurrentOverbookingRatioBw((SDNVm) vm);
log = LogWriter.getLogger("vm_OBR_bw.csv");
log.printLine(vm.getName()+","+logTime+","+bwOBR);
}
}
}
示例5: start
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
/**
* Starts the simulation.
*
* @param experimentName
* the experiment name
* @param outputFolder
* the output folder
* @param vmAllocationPolicy
* the vm allocation policy
*/
protected void start(String experimentName, String outputFolder,
VmAllocationPolicy vmAllocationPolicy) {
System.out.println("Starting " + experimentName);
try {
// 创建数据中心
PowerDatacenter datacenter = (PowerDatacenter) Helper
.createDatacenter("Datacenter", PowerDatacenter.class,
hostList, vmAllocationPolicy);
// 允许进行迁移
datacenter.setDisableMigrations(false);
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);
}
示例6: start
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
/**
* Starts the simulation.
*
* @param experimentName the experiment name
* @param outputFolder the output folder
* @param vmAllocationPolicy the vm allocation policy
*/
protected void start(String experimentName, String outputFolder, VmAllocationPolicy vmAllocationPolicy) {
System.out.println("Starting " + experimentName);
try {
PowerDatacenter datacenter = (PowerDatacenter) Helper.createDatacenter(
"Datacenter",
PowerDatacenter.class,
hostList,
vmAllocationPolicy);
datacenter.setDisableMigrations(false);
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);
}
示例7: WorkflowDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public WorkflowDatacenter(String name,
DatacenterCharacteristics characteristics,
VmAllocationPolicy vmAllocationPolicy,
List<Storage> storageList,
double schedulingInterval) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
}
示例8: PowerDatacenterExtra
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public PowerDatacenterExtra(String name,
DatacenterCharacteristics characteristics,
VmAllocationPolicy vmAllocationPolicy, List<Storage> storageList,
double schedulingInterval) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList,
schedulingInterval);
}
示例9: getVmAllocationPolicy
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
@Override
public VmAllocationPolicy getVmAllocationPolicy(List<? extends Host> hostList, int dataCenterIndex) {
return new VmAllocationPolicy_Custom(hostList,dataCenterIndex);
}
示例10: SDNDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public SDNDatacenter(String name, DatacenterCharacteristics characteristics, VmAllocationPolicy vmAllocationPolicy, List<Storage> storageList, double schedulingInterval, NetworkOperatingSystem nos) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
this.nos=nos;
//nos.init();
}
示例11: FogDevice
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public FogDevice(
String name,
FogDeviceCharacteristics characteristics,
VmAllocationPolicy vmAllocationPolicy,
List<Storage> storageList,
double schedulingInterval,
double uplinkBandwidth, double downlinkBandwidth, double uplinkLatency, double ratePerMips) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
setCharacteristics(characteristics);
setVmAllocationPolicy(vmAllocationPolicy);
setLastProcessTime(0.0);
setStorageList(storageList);
setVmList(new ArrayList<Vm>());
setSchedulingInterval(schedulingInterval);
setUplinkBandwidth(uplinkBandwidth);
setDownlinkBandwidth(downlinkBandwidth);
setUplinkLatency(uplinkLatency);
setRatePerMips(ratePerMips);
setAssociatedActuatorIds(new ArrayList<Pair<Integer, Double>>());
for (Host host : getCharacteristics().getHostList()) {
host.setDatacenter(this);
}
setActiveApplications(new ArrayList<String>());
// If this resource doesn't have any PEs then no useful at all
if (getCharacteristics().getNumberOfPes() == 0) {
throw new Exception(super.getName()
+ " : Error - this entity has no PEs. Therefore, can't process any Cloudlets.");
}
// stores id of this class
getCharacteristics().setId(super.getId());
applicationMap = new HashMap<String, Application>();
appToModulesMap = new HashMap<String, List<String>>();
northTupleQueue = new LinkedList<Tuple>();
southTupleQueue = new LinkedList<Pair<Tuple, Integer>>();
setNorthLinkBusy(false);
setSouthLinkBusy(false);
setChildrenIds(new ArrayList<Integer>());
setChildToOperatorsMap(new HashMap<Integer, List<String>>());
this.cloudTrafficMap = new HashMap<Integer, Integer>();
this.lockTime = 0;
this.energyConsumption = 0;
this.lastUtilization = 0;
setTotalCost(0);
setModuleInstanceCount(new HashMap<String, Map<String, Integer>>());
setChildToLatencyMap(new HashMap<Integer, Double>());
}
示例12: PSDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public PSDatacenter(String name, DatacenterCharacteristics characteristics, VmAllocationPolicy vmAllocationPolicy,
List<Storage> storageList, double schedulingInterval) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
}
示例13: start
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
/**
* Starts the simulation.
*
* @param experimentName the experiment name
* @param outputFolder the output folder
* @param vmAllocationPolicy the vm allocation policy
*/
protected void start(String experimentName, String outputFolder, VmAllocationPolicy vmAllocationPolicy) {
System.out.println("Starting " + experimentName);
try {
PowerDatacenter datacenter = (PowerDatacenter) Helper.createDatacenter(
"Datacenter",
PowerDatacenter.class,
hostList,
vmAllocationPolicy);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
CloudSim.terminateSimulation(Constants.SIMULATION_LIMIT);
//Start Simulation
double lastClock = CloudSim.startSimulation();
//Simulation Completed!
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);
}
示例14: createDatacenter
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
/**
* Creates the datacenter.
*
* @param name the name
* @param datacenterClass the datacenter class
* @param hostList the host list
* @param vmAllocationPolicy the vm allocation policy
* @param simulationLength
*
* @return the power datacenter
*
* @throws Exception the exception
*/
public static Datacenter createDatacenter(
String name,
Class<? extends Datacenter> datacenterClass,
List<PowerHost> hostList,
VmAllocationPolicy vmAllocationPolicy) throws Exception {
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this resource
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch,
os,
vmm,
hostList,
time_zone,
cost,
costPerMem,
costPerStorage,
costPerBw);
Datacenter datacenter = null;
try {
datacenter = datacenterClass.getConstructor(
String.class,
DatacenterCharacteristics.class,
VmAllocationPolicy.class,
List.class,
Double.TYPE).newInstance(
name,
characteristics,
vmAllocationPolicy,
new LinkedList<Storage>(),
Constants.SCHEDULING_INTERVAL);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
return datacenter;
}
示例15: create
import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public VmAllocationPolicy create(List<? extends Host> list,
HostSelectionPolicy hostSelectionPolicy,
VmMigrationPolicy vmMigrationPolicy
);