当前位置: 首页>>代码示例>>Java>>正文


Java VmAllocationPolicy类代码示例

本文整理汇总了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);
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:25,代码来源:PowerDatacenter.java

示例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;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:38,代码来源:SDNExample.java

示例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();
}
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:9,代码来源:SDNDatacenter.java

示例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);
		}
	}
}
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:16,代码来源:NetworkOperatingSystem.java

示例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);
}
 
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:46,代码来源:RunnerAbstract.java

示例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);
}
 
开发者ID:tuwiendsg,项目名称:CAPT,代码行数:47,代码来源:RunnerAbstract.java

示例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);
}
 
开发者ID:WorkflowSim,项目名称:WorkflowSim-1.0,代码行数:8,代码来源:WorkflowDatacenter.java

示例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);
}
 
开发者ID:StVak,项目名称:cloudsimPowerStats,代码行数:8,代码来源:PowerDatacenterExtra.java

示例9: getVmAllocationPolicy

import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
@Override
public VmAllocationPolicy getVmAllocationPolicy(List<? extends Host> hostList, int dataCenterIndex) {
	return new VmAllocationPolicy_Custom(hostList,dataCenterIndex);
}
 
开发者ID:CagataySonmez,项目名称:EdgeCloudSim,代码行数:5,代码来源:SampleScenarioFactory.java

示例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();
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:7,代码来源:SDNDatacenter.java

示例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>());
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:53,代码来源:FogDevice.java

示例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);
}
 
开发者ID:raphaeldeaquino,项目名称:mcloudsim,代码行数:5,代码来源:PSDatacenter.java

示例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);
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:52,代码来源:RunnerAbstract.java

示例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;
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:59,代码来源:Helper.java

示例15: create

import org.cloudbus.cloudsim.VmAllocationPolicy; //导入依赖的package包/类
public VmAllocationPolicy create(List<? extends Host> list,
HostSelectionPolicy hostSelectionPolicy,
VmMigrationPolicy vmMigrationPolicy
);
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:5,代码来源:SDNExampleOverbooking.java


注:本文中的org.cloudbus.cloudsim.VmAllocationPolicy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。