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


Java Cloudlet.setVmId方法代码示例

本文整理汇总了Java中org.cloudbus.cloudsim.Cloudlet.setVmId方法的典型用法代码示例。如果您正苦于以下问题:Java Cloudlet.setVmId方法的具体用法?Java Cloudlet.setVmId怎么用?Java Cloudlet.setVmId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.cloudbus.cloudsim.Cloudlet的用法示例。


在下文中一共展示了Cloudlet.setVmId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processActivity

import org.cloudbus.cloudsim.Cloudlet; //导入方法依赖的package包/类
private void processActivity(Activity ac, Request req, int vmId) {
	if(ac instanceof Transmission) {
		Transmission tr = (Transmission)ac;

		Package pkg = tr.getPackage();
		//send package to router via channel (NOS)
		nos.addPackageToChannel(this, pkg);
		
		pkg.setStartTime(CloudSim.clock());
	}
	else if(ac instanceof Processing) {
			Cloudlet cl = ((Processing) ac).getCloudlet();
			cl.setVmId(vmId);
			
			requestsTable.put(cl, req);
			sendNow(host.getDatacenter().getId(),CloudSimTags.CLOUDLET_SUBMIT,cl);
	} else {
		Log.printLine(CloudSim.clock() + ": " + getName() + ": Activity is unknown..");
	}
	
	
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:23,代码来源:SDNHost.java

示例2: generateCloudlet

import org.cloudbus.cloudsim.Cloudlet; //导入方法依赖的package包/类
private Cloudlet generateCloudlet(int vmId, int length) {
	int peNum=1;
	long fileSize = 300;
	long outputSize = 300;
	Cloudlet cloudlet= new Cloudlet(cloudletId++, length, peNum, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
	cloudlet.setUserId(userId);
	cloudlet.setVmId(vmId);

	return cloudlet;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:11,代码来源:WorkloadParser.java

示例3: submitRequest

import org.cloudbus.cloudsim.Cloudlet; //导入方法依赖的package包/类
public void submitRequest(Request req){
	Cloudlet cl = new Cloudlet(id++,mipsPerOp,1,0,0,new UtilizationModelFull(),new UtilizationModelFull(),new UtilizationModelFull());
	cl.setVmId(vm.getId());
	
	host.schedule(host.getHost().getDatacenter().getId(), 0.0, CloudSimTags.CLOUDLET_SUBMIT, cl);
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:7,代码来源:Middlebox.java

示例4: submitRequest

import org.cloudbus.cloudsim.Cloudlet; //导入方法依赖的package包/类
public void submitRequest(Request req){
		Cloudlet cl = new Cloudlet(id++,mipsPerOp,1,0,0,new UtilizationModelFull(),new UtilizationModelFull(),new UtilizationModelFull());
		cl.setVmId(vm.getId());
		
//		host.schedule(host.getDatacenter().getId(), 0.0, CloudSimTags.CLOUDLET_SUBMIT, cl);
	}
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:7,代码来源:Middlebox.java

示例5: main

import org.cloudbus.cloudsim.Cloudlet; //导入方法依赖的package包/类
/**
 * Creates main() to run this example.
 *
 * @param args the args
 */
@SuppressWarnings("unused")
public static void main(String[] args) {

	Log.printLine("Starting CloudSimExample1...");

	try {
		// 1,First step: Initialize the CloudSim package. It should be called
		// before creating any entities.
		int num_user = 1; // number of cloud users 
		Calendar calendar = Calendar.getInstance();
		boolean trace_flag = false; // mean trace events

		// 包含CloudSim的一些属性的初始化 Initialize the CloudSim library
		CloudSim.init(num_user, calendar, trace_flag);

		// 2,Second step: Create Datacenters
		// Datacenters are the resource providers in CloudSim. We need at
		// list one of them to run a CloudSim simulation
		Datacenter datacenter0 = createDatacenter("Datacenter_0");

		// 3,Third step: Create Broker 创建云计算服务平台代理
		DatacenterBroker broker = createBroker();
		int brokerId = broker.getId();

		// 4,Fourth step: Create one virtual machine
		vmlist = new ArrayList<Vm>();	//a,创建虚拟机列表

		// VM description	虚拟机的参数
		int vmid = 0;	//虚拟机id
		int mips = 1000;	//每秒百万条指令
		long size = 10000; // image size (MB)镜像大小 size amount of storage
		int ram = 512; // vm memory (MB)内存大小
		long bw = 1000;	//带宽
		int pesNumber = 1; // number of cpus	cpu数
		String vmm = "Xen"; // VMM name	虚拟机名字 vmm virtual machine monitor

		// create VM	b,创建一个虚拟机
		// new CloudletSchedulerTimeShared()设置虚拟机的调度策略
		Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());	
		// add the VM to the vmList	c,把虚拟机假如虚拟机列表
		vmlist.add(vm);
		// submit vm list to the broker	d,将虚拟机列表提交到数据中心代理中
		broker.submitVmList(vmlist);
		// 5,Fifth step: Create one Cloudlet	创建云任务
		cloudletList = new ArrayList<Cloudlet>();
		// Cloudlet properties	云任务参数
		int id = 0;
		long length = 400000;
		long fileSize = 300;
		long outputSize = 300;
		UtilizationModel utilizationModel = new UtilizationModelFull();//设置资源使用率模型

		Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
		cloudlet.setUserId(brokerId);
		cloudlet.setVmId(vmid);

		// add the cloudlet to the list
		cloudletList.add(cloudlet);

		// submit cloudlet list to the broker
		broker.submitCloudletList(cloudletList);	//将云任务提交给代理
		// 6,Sixth step: Starts the simulation
		CloudSim.startSimulation();		//开始模拟
		CloudSim.stopSimulation();		//结束模拟
		//7,Final step: Print results when simulation is over 输出结果
		List<Cloudlet> newList = broker.getCloudletReceivedList();
		printCloudletList(newList);

		Log.printLine("CloudSimExample1 finished!");
	} catch (Exception e) {
		e.printStackTrace();
		Log.printLine("Unwanted errors happen");
	}
}
 
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:80,代码来源:CloudSimExample1.java


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