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


Java VmSchedulerSpaceShared类代码示例

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


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

示例1: must_execute_an_experiment_with_one_datacenter

import org.cloudbus.cloudsim.VmSchedulerSpaceShared; //导入依赖的package包/类
@Test
    public void must_execute_an_experiment_with_one_datacenter()
    {
//        Experiment experiment = new ExperimentBuilder()
//                                    .with(new DatacenterBuilder().with(5).hosts(
//                                          new HostBuilder()
//                                          .with(4, new CoreBuilder())
//                                          .with(new RamBuilder().with().capacity(512))
//                                          .with(new StorageBuilder().with().capacity(1000))))
//                                    .build();
//        experiment.run();
        
        Host host = new HostBuilder().with(4).cores().with(1000).mips().using().provisioner(PeProvisionerSimple.class)
                         .with(512).ram().using().provisioner(RamProvisionerSimple.class)
                         .with(1000).storage().with(1000).bw().using().provisioner(BwProvisionerSimple.class)
                         .using().vm().scheduler(VmSchedulerSpaceShared.class).build();
        
        
        Datacenter datacenter = new DatacenterBuilder().characteristics()
                                                       .os().linux().xen()
                                                       .costs().bw(1).cpu(1).memory(1).storage(1).timezone(1)
                                                       .storage().zero().build();
        
        System.out.println(host);
        
//        new ExperimentBuilder()
//                .with(1)
//                .dataCenter()
//                .each()
//                .with(5).hosts(with(4).cpu().and().with(512).ram().and().with(1).storage(with().capacity(1000)))
//                .architecture(xen()).cost(cpu(2.3).and().memory(2.8).and().storage(3.2).and().bw(2.8));
        
    }
 
开发者ID:alessandroleite,项目名称:cloudsim-dsl,代码行数:34,代码来源:ExperimentTest.java

示例2: createHosts

import org.cloudbus.cloudsim.VmSchedulerSpaceShared; //导入依赖的package包/类
private List<EdgeHost> createHosts(Element datacenterElement){

		// Here are the steps needed to create a PowerDatacenter:
		// 1. We need to create a list to store one or more Machines
		List<EdgeHost> hostList = new ArrayList<EdgeHost>();
		
		Element location = (Element)datacenterElement.getElementsByTagName("location").item(0);
		String attractiveness = location.getElementsByTagName("attractiveness").item(0).getTextContent();
		int wlan_id = Integer.parseInt(location.getElementsByTagName("wlan_id").item(0).getTextContent());
		int x_pos = Integer.parseInt(location.getElementsByTagName("x_pos").item(0).getTextContent());
		int y_pos = Integer.parseInt(location.getElementsByTagName("y_pos").item(0).getTextContent());
		SimSettings.PLACE_TYPES placeType = SimUtils.stringToPlace(attractiveness);

		NodeList hostNodeList = datacenterElement.getElementsByTagName("host");
		for (int j = 0; j < hostNodeList.getLength(); j++) {
			Node hostNode = hostNodeList.item(j);
			
			Element hostElement = (Element) hostNode;
			int numOfCores = Integer.parseInt(hostElement.getElementsByTagName("core").item(0).getTextContent());
			double mips = Double.parseDouble(hostElement.getElementsByTagName("mips").item(0).getTextContent());
			int ram = Integer.parseInt(hostElement.getElementsByTagName("ram").item(0).getTextContent());
			long storage = Long.parseLong(hostElement.getElementsByTagName("storage").item(0).getTextContent());
			long bandwidth = SimSettings.getInstance().getWlanBandwidth() / hostNodeList.getLength();
			
			// 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
			//    create a list to store these PEs before creating
			//    a Machine.
			List<Pe> peList = new ArrayList<Pe>();

			// 3. Create PEs and add these into the list.
			//for a quad-core machine, a list of 4 PEs is required:
			for(int i=0; i<numOfCores; i++){
				peList.add(new Pe(i, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
			}
			
			//4. Create Hosts with its id and list of PEs and add them to the list of machines
			EdgeHost host = new EdgeHost(
					hostIdCounter,
					new RamProvisionerSimple(ram),
					new BwProvisionerSimple(bandwidth), //kbps
					storage,
					peList,
					new VmSchedulerSpaceShared(peList)
				);
			
			host.setPlace(new Location(placeType, wlan_id, x_pos, y_pos));
			hostList.add(host);
			hostIdCounter++;
		}

		return hostList;
	}
 
开发者ID:CagataySonmez,项目名称:EdgeCloudSim,代码行数:53,代码来源:EdgeServerManager.java


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