• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CloudletSchedulerTimeShared类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CloudletSchedulerTimeShared类属于org.cloudbus.cloudsim包,在下文中一共展示了CloudletSchedulerTimeShared类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createVM

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static List<Vm> createVM(int userId, int vms) {

		//Creates a container to store VMs. This list is passed to the broker later
		LinkedList<Vm> list = new LinkedList<Vm>();

		//VM Parameters
		long size = 10000; //image size (MB)
		int ram = 512; //vm memory (MB)
		int mips = 1000;
		long bw = 1000;
		int pesNumber = 1; //number of cpus
		String vmm = "Xen"; //VMM name

		//create VMs
		Vm[] vm = new Vm[vms];

		for(int i=0;i<vms;i++){
			vm[i] = new Vm(i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
			//for creating a VM with a space shared scheduling policy for cloudlets:
			//vm[i] = Vm(i, userId, mips, pesNumber, ram, bw, size, priority, vmm, new CloudletSchedulerSpaceShared());

			list.add(vm[i]);
		}

		return list;
	}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:27,代码来源:CloudSimExample6.java


示例2: createVM

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static List<Vm> createVM(int userId, int vms, int idShift) {
	//Creates a container to store VMs. This list is passed to the broker later
	LinkedList<Vm> list = new LinkedList<Vm>();

	//VM Parameters
	long size = 10000; //image size (MB)
	int ram = 512; //vm memory (MB)
	int mips = 250;
	long bw = 1000;
	int pesNumber = 1; //number of cpus
	String vmm = "Xen"; //VMM name

	//create VMs
	Vm[] vm = new Vm[vms];

	for(int i=0;i<vms;i++){
		vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
		list.add(vm[i]);
	}

	return list;
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:23,代码来源:CloudSimExample7.java


示例3: createVM

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static List<Vm> createVM(int userId, int vms, int idShift) {
	// Creates a container to store VMs. This list is passed to the broker later
	LinkedList<Vm> list = new LinkedList<Vm>();
	
	// VM Parameters
	long size = 10000; // image size (MB)
	int ram = 512; // vm memory (MB)
	int mips = 250;
	long bw = 1000;
	int pesNumber = 1; // number of cpus
	String vmm = "Xen"; // VMM name
	
	// create VMs
	Vm[] vm = new Vm[vms];
	
	for (int i = 0; i < vms; i++) {
		vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm,
				new CloudletSchedulerTimeShared());
		list.add(vm[i]);
	}
	
	return list;
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:24,代码来源:CloudSimExample8.java


示例4: createVM

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static List<Vm> createVM(int userId, int vms, int idShift) {
	//Creates a container to store VMs. This list is passed to the broker later
	LinkedList<Vm> list = new LinkedList<Vm>();

	//VM Parameters
	long size = 10000; //image size (MB)
	int ram = 512; //vm memory (MB)
	int mips = 250;
	long bw = 1000;
	int pesNumber = 1; //number of cpus
	String vmm = "Xen"; //VMM name

	//create VMs
	Vm[] vm = new Vm[vms];

	for(int i=0;i < vms;i++){
		vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
		list.add(vm[i]);
	}

	return list;
}
 
开发者ID:hewolf,项目名称:VirtualMachinePlacement,代码行数:23,代码来源:CloudSimExample9.java


示例5: createVmList

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
public void createVmList(int brockerId){
	int hostCounter=0;
	int vmCounter=0;
	
	//Create VMs for each hosts
	Document doc = SimSettings.getInstance().getEdgeDevicesDocument();
	NodeList datacenterList = doc.getElementsByTagName("datacenter");
	for (int i = 0; i < datacenterList.getLength(); i++) {
		Node datacenterNode = datacenterList.item(i);
		Element datacenterElement = (Element) datacenterNode;
		NodeList hostNodeList = datacenterElement.getElementsByTagName("host");
		for (int j = 0; j < hostNodeList.getLength(); j++) {
			
			vmList.add(hostCounter, new ArrayList<EdgeVM>());
			
			Node hostNode = hostNodeList.item(j);
			Element hostElement = (Element) hostNode;
			NodeList vmNodeList = hostElement.getElementsByTagName("VM");
			for (int k = 0; k < vmNodeList.getLength(); k++) {
				Node vmNode = vmNodeList.item(k);					
				Element vmElement = (Element) vmNode;

				String vmm = vmElement.getAttribute("vmm");
				int numOfCores = Integer.parseInt(vmElement.getElementsByTagName("core").item(0).getTextContent());
				double mips = Double.parseDouble(vmElement.getElementsByTagName("mips").item(0).getTextContent());
				int ram = Integer.parseInt(vmElement.getElementsByTagName("ram").item(0).getTextContent());
				long storage = Long.parseLong(vmElement.getElementsByTagName("storage").item(0).getTextContent());
				long bandwidth = SimSettings.getInstance().getWlanBandwidth() / (hostNodeList.getLength()+vmNodeList.getLength());
				
				//VM Parameters		
				EdgeVM vm = new EdgeVM(vmCounter, brockerId, mips, numOfCores, ram, bandwidth, storage, vmm, new CloudletSchedulerTimeShared());
				vm.setVmType(SimSettings.VM_TYPES.EDGE_VM);
				vmList.get(hostCounter).add(vm);
				vmCounter++;
			}

			hostCounter++;
		}
	}
}
 
开发者ID:CagataySonmez,项目名称:EdgeCloudSim,代码行数:41,代码来源:EdgeServerManager.java


示例6: createVM

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static List<Vm> createVM(int userId, int vms) {

		//Creates a container to store VMs. This list is passed to the broker later
		LinkedList<Vm> list = new LinkedList<Vm>();

		//VM Parameters
		long size = 10000; //image size (MB)
		int ram = 512; //vm memory (MB)
		int mips = 1000;
		long bw = 1000;
		int pesNumber = 1; //number of cpus
		String vmm = "Xen"; //VMM name
		Random r = new Random(1);
		//create VMs
		Vm[] vm = new Vm[vms];

		for(int i=0;i<vms;i++){
			mips = 500 + r.nextInt(500);
			vm[i] = new Vm(i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
			//for creating a VM with a space shared scheduling policy for cloudlets:
			//vm[i] = Vm(i, userId, mips, pesNumber, ram, bw, size, priority, vmm, new CloudletSchedulerSpaceShared());

			list.add(vm[i]);
		}

		return list;
	}
 
开发者ID:sidjee,项目名称:Ant-Colony-Optimization-Framework,代码行数:28,代码来源:graphImplement.java


示例7: createSmall

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static Vm createSmall(int userId)
{		
	Vm vm = new Vm(ResourceCounter.nextVmID(), 
			userId, 
			6502.18, 
			1, 
			new Double(1.7 * 1024 ).intValue(), // RAM: 1.7 GB
			new Long(1 * 1024 * 1024), // i assume at least 1MB p/s  
			new Long(160 * 1024), // DISK: 160 GB
			"Xen", 
			new CloudletSchedulerTimeShared());
	VmTyped vmt = new VmTyped(vm, VmType.SMALL);
	return vm;
}
 
开发者ID:ecarlini,项目名称:smartfed,代码行数:15,代码来源:VmFactory.java


示例8: createMedium

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static Vm createMedium(int userId)
{		
	Vm vm = new Vm(ResourceCounter.nextVmID(), 
			userId, 
			6502.18, // data not available, i assume as small instances
			1, 
			new Double(3.75 * 1024).intValue(), // 3.75 GB
			new Long(1 * 1024 * 1024), // i assume at least 1MB p/s  
			new Long(410 * 1024), // 410 GB
			"Xen", 
			new CloudletSchedulerTimeShared());
	VmTyped vmt = new VmTyped(vm, VmType.MEDIUM);
	return vm;
}
 
开发者ID:ecarlini,项目名称:smartfed,代码行数:15,代码来源:VmFactory.java


示例9: createLarge

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static Vm createLarge(int userId)
{		
	Vm vm = new Vm(ResourceCounter.nextVmID(), 
			userId, 
			8022, 
			2, 
			new Double(7.5 * 1024).intValue(), // 7.5 GB
			new Long(1 * 1024 * 1024), // i assume at least 1MB p/s  
			new Long(850 * 1024), // 850 GB
			"Xen", 
			new CloudletSchedulerTimeShared());
	VmTyped vmt = new VmTyped(vm, VmType.LARGE);
	return vm;
}
 
开发者ID:ecarlini,项目名称:smartfed,代码行数:15,代码来源:VmFactory.java


示例10: createXLarge

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static Vm createXLarge(int userId)
{		
	Vm vm = new Vm(ResourceCounter.nextVmID(), 
			userId, 
			5202.15 * 4, 
			4, 
			new Double(15 * 1024).intValue(), // 15 GB
			new Long(1 * 1024 * 1024), // i assume at least 1MB p/s  
			new Long(1690 * 1024), // 1690 GB
			"Xen", 
			new CloudletSchedulerTimeShared());
	VmTyped vmt = new VmTyped(vm, VmType.XLARGE);
	return vm;
}
 
开发者ID:ecarlini,项目名称:smartfed,代码行数:15,代码来源:VmFactory.java


示例11: getCustomVm

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
public static Vm getCustomVm(int userId, double mips, int cores, int ramMB, long bandMB, long diskMB)
{		
	VmTyped vmt = new VmTyped(-1, 
			userId, 
			mips, 
			cores, 
			ramMB,
			bandMB,
			diskMB,
			"Xen", 
			new CloudletSchedulerTimeShared(), 
			VmType.CUSTOM);	
	return vmt;
}
 
开发者ID:ecarlini,项目名称:smartfed,代码行数:15,代码来源:VmFactory.java


示例12: getDesiredVm

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
/**
 * Create a customVm that will not be actually deployed, thus it will have meaningless value as internal id. 
 * @param userId
 * @param mips
 * @param cores
 * @param ramMB
 * @param bandMB
 * @param diskMB
 * @return
 */
public static Vm getDesiredVm(int userId, double mips, int cores, int ramMB, long bandMB, long diskMB){
	Vm vm = new Vm(-1, 
			userId, 
			mips, 
			cores, 
			ramMB,
			bandMB,
			diskMB,
			"Xen", 
			new CloudletSchedulerTimeShared());	
	VmTyped vmt = new VmTyped(vm, VmType.CUSTOM);
	return vmt;
}
 
开发者ID:ecarlini,项目名称:smartfed,代码行数:24,代码来源:VmFactory.java


示例13: addVMs

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
/**
 * Creates the virtual machines.
 * 
 * @param VMNr
 *            : the number of virtual machines to create brokerId: the id of
 *            the broker created timeSharedScheduling: to choose between the
 *            time shared or space shared shceduling algorithms
 * 
 * @return list of virtual machines
 * 
 */
private static void addVMs(int VMNr, int brokerId, boolean timeSharedScheduling, int mips) {

	// VM description
	//int mips = Processors.Intel.Pentium_4_Extreme_Edition.mips;
	//int mips = Processors.AMD.Athlon_FX_57.mips;
	long size = 10240; // image size (MB)
	int ram = 512; // vm memory (MB)
	long bw = 1024; // MB/s
	int pesNumber = 1; // number of cpus
	String vmm = "Xen"; // VMM name

	for (int i = 0; i < VMNr; i++) {

		Vm vm;
		
		int VM_ID = vmlist.size();
		
		if (timeSharedScheduling) {
			// create VM that uses time shared scheduling to schedule Cloudlets
			vm = new Vm(VM_ID, brokerId, mips, pesNumber, ram, bw, size, vmm,
					new CloudletSchedulerTimeShared());
		}

		else {
			// create VM that uses space shared scheduling to schedule Cloudlets
			vm = new Vm(VM_ID, brokerId, mips, pesNumber, ram, bw, size, vmm,
					new CloudletSchedulerSpaceShared());
		}

		// add the VM to the vmList
		vmlist.add(vm);
	}
}
 
开发者ID:halolimat,项目名称:clocacits,代码行数:45,代码来源:pso_example2.java


示例14: createVMs

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
/**
 * Creates the virtual machines.
 * 
 * @param
 * 			VMNr: the number of virtual machines to create
 * 			brokerId: the id of the broker created
 * 			timeSharedScheduling: to choose between the time shared or space shared shceduling algorithms
 *
 * @return list of virtual machines
 * 
 */	
private static List<Vm> createVMs(int VMNr, int brokerId, boolean timeSharedScheduling){
	
	/** The vmlist. */			
	List<Vm> vmlist = new ArrayList<Vm>();
	
	// VM description
	int mips = Processors.Intel.Pentium_4_Extreme_Edition.mips;
	long size = 10240; // image size (MB)
	int ram = 512; // vm memory (MB)
	long bw = 1024; // MB/s
	int pesNumber = 1; // number of cpus
	String vmm = "Xen"; // VMM name

	for(int i = 0 ; i < VMNr ; i++){
		
		Vm vm;
		
		if(timeSharedScheduling){
			//create VM that uses time shared scheduling to schedule Cloudlets
			vm = new Vm(i, brokerId, mips, pesNumber, ram, bw, size, vmm,	new CloudletSchedulerTimeShared());
		}
		
		else{
			//create VM that uses space shared scheduling to schedule Cloudlets
			vm = new Vm(i, brokerId, mips, pesNumber, ram, bw, size, vmm,	new CloudletSchedulerSpaceShared());
		}
		
		// add the VM to the vmList
		vmlist.add(vm);
	}
	
	return vmlist;
}
 
开发者ID:halolimat,项目名称:clocacits,代码行数:45,代码来源:pso_example3_avgExecTime.java


示例15: addVMs

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
private static void addVMs(int VMNr, int brokerId, boolean timeSharedScheduling, int mips) {

		mips = Processors.Intel.Pentium_4_Extreme_Edition.mips;
		//mips = Processors.AMD.Athlon_FX_57.mips;
		long size = 10000;
		int ram = 512;
		long bw = 1000;
		int pesNumber = 1;
		String vmm = "Xen";

		for (int i = 0; i < VMNr; i++) {

			Vm vm;
			
			int VM_ID = vmlist.size();
			
			if (timeSharedScheduling) {
				vm = new Vm(VM_ID, brokerId, mips, pesNumber, ram, bw, size, vmm,
						new CloudletSchedulerTimeShared());
			}

			else {
				vm = new Vm(VM_ID, brokerId, mips, pesNumber, ram, bw, size, vmm,
						new CloudletSchedulerSpaceShared());
			}

			vmlist.add(vm);
		}
	}
 
开发者ID:halolimat,项目名称:clocacits,代码行数:30,代码来源:pso_example1.java


示例16: main

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的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


示例17: createVMandJob

import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; //导入依赖的package包/类
public void createVMandJob(int delay,JobType jtype) {
	
	SoheilSimBroker broker= createBroker(super.getName()+idShift);
	
	sim_count++;
	//Creates a container to store VMs. This list is passed to the broker later
	LinkedList<SoheilSimVm> list = new LinkedList<SoheilSimVm>();

	//VM Parameters
	long size = Parameters.STORAGE; //image size (MB)
	int ram = Parameters.RAM; //vm memory (MB)
	int mips = Parameters.MIPS;
	long bw = Parameters.BW;
	int pesNumber = Parameters.PES_NUM; //number of cpus
	String vmm = "Xen"; //VMM name

	//create VMs



	SoheilSimVm vm = new SoheilSimVm(idShift, broker.getId(), mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
	vm.setSubmissionTime(delay); /**************/
	list.add(vm);
	setVmList(list);
	broker.submitVmList(list);
	
	
	
	// Creates a container to store Cloudlets
			LinkedList<Cloudlet> clist = new LinkedList<Cloudlet>();

			//cloudlet parameters
			//long length = 400000;
			//Min + (int)(Math.random() * ((Max - Min) + 1))
			//long length = Parameters.MIN_EXEC_LENGTH + (long)(Math.random() * ((Parameters.MAX_EXEC_LENGTH - Parameters.MIN_EXEC_LENGTH) + 1)); old v1

			int diff=(int) (Parameters.MAX_EXEC_LENGTH - Parameters.MIN_EXEC_LENGTH);
			long length = Parameters.MIN_EXEC_LENGTH + random.nextInt(diff);
			//LogInFile.saveInfo(""+length, "length");
			
			long fileSize = 300;
			long outputSize = 300;
			//int pesNumber = 1;
			UtilizationModel utilizationModel = new UtilizationModelFull();

			

			if(jtype == JobType.ONDEMAND)
				LogInFile.saveInfo(jtype+"\t"+delay+"\t"+ length, "wload_od_soheil");
			else
				LogInFile.saveInfo(jtype+"\t"+delay+"\t"+ length, "wload_res_soheil");
				
			Cloudlet cloudlet = new Cloudlet(idShift, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
				
			cloudlet.setUserId(broker.getId());
			cloudlet.setJobType(jtype);
			clist.add(cloudlet);
				
			
			
			setCloudletList(clist);
			broker.submitCloudletList(clist);

			

				broker.bindCloudletToVm(idShift,idShift);
			
				brokerList.add(broker);
			
			idShift++;
			
			CloudSim.resumeSimulation();
			
	
}
 
开发者ID:tuwiendsg,项目名称:CAPT,代码行数:76,代码来源:RequestGenBroker.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SWTObservables类代码示例发布时间:2022-05-21
下一篇:
Java HexStringSplit类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap