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

Java VmAllocationPolicySimple类代码示例

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

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



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

示例1: createDatacenter

import org.cloudbus.cloudsim.VmAllocationPolicySimple; //导入依赖的package包/类
/**
 * Creates a datacenter
 * 
 * @param name
 *            the datacenter name
 * @return the datacenter
 */
public static Datacenter createDatacenter(String name) {
	// Here are the steps needed to create a Datacenter:
	// We need to create a list to store our machine
	List<Host> hostList = createHostList(SimulationConstants.NUM_HOST);

	// Create a DatacenterCharacteristics object that stores the
	// properties of a data center: architecture, OS, list of
	// Machines, allocation policy: time- or space-shared, time zone
	// and its price (G$/Pe time unit).
	String arch = "x86"; // system architecture
	String os = "Linux"; // operating system
	String vmm = "Xen";
	double time_zone = 10.0; // time zone this resource located

	// the cost of using processing in this resource
	double cost = SimulationConstants.BROKER_VM_COST_PER_PROCESSING;

	// the cost of using memory in this resource
	double costPerMem = SimulationConstants.BROKER_VM_COST_PER_MEMORY;

	// the cost of using storage in this resource
	double costPerStorage = SimulationConstants.BROKER_VM_COST_PER_STORAGE;

	// the cost of using bw in this resource
	double costPerBw = 0.0;

	// we are not adding SAN devices by now
	LinkedList<Storage> storageList = new LinkedList<Storage>();

	DatacenterCharacteristics characteristics = new DatacenterCharacteristics(arch, os, vmm, hostList, time_zone,
			cost, costPerMem, costPerStorage, costPerBw);

	// We need to create a Datacenter object.
	Datacenter datacenter = null;
	try {
		datacenter = new PSDatacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
	} catch (Exception e) {
		e.printStackTrace();
	}

	return datacenter;
}
 
开发者ID:raphaeldeaquino,项目名称:mcloudsim,代码行数:50,代码来源:Helper.java


示例2: createDatacenter

import org.cloudbus.cloudsim.VmAllocationPolicySimple; //导入依赖的package包/类
/**
 * Creates a datacenter
 * 
 * @return the datacenter
 * @throws SimulationCreationException
 */
public static Datacenter createDatacenter(ResourceSynthesisResult resourceSynthesisResult)
		throws SimulationCreationException {
	// Here are the steps needed to create a Datacenter:
	// We need to create a list to store our machine
	List<Host> hostList = createHostList(SimulationConstants.NUM_HOST);

	// Create a DatacenterCharacteristics object that stores the
	// properties of a data center: architecture, OS, list of
	// Machines, allocation policy: time- or space-shared, time zone
	// and its price (G$/Pe time unit).
	String arch = "x86"; // system architecture
	String os = "Linux"; // operating system
	String vmm = "Xen";
	double time_zone = 10.0; // time zone this resource located

	// the cost of using processing in this resource
	double cost = SimulationConstants.BROKER_VM_COST_PER_PROCESSING;

	// the cost of using memory in this resource
	double costPerMem = SimulationConstants.BROKER_VM_COST_PER_MEMORY;

	// the cost of using storage in this resource
	double costPerStorage = SimulationConstants.BROKER_VM_COST_PER_STORAGE;

	// the cost of using bw in this resource
	double costPerBw = 0.0;

	// we are not adding SAN devices by now
	LinkedList<Storage> storageList = new LinkedList<Storage>();

	DatacenterCharacteristics characteristics = new DatacenterCharacteristics(arch, os, vmm, hostList, time_zone,
			cost, costPerMem, costPerStorage, costPerBw);

	String provider = resourceSynthesisResult.getProvider();

	// We need to create a Datacenter object.
	Datacenter datacenter = null;
	try {
		datacenter = new PSDatacenter(provider, characteristics, new VmAllocationPolicySimple(hostList), storageList,
				DATACENTER_SCHED_INTERVAL);
	} catch (Exception e) {
		throw new SimulationCreationException(e.getMessage(), e);
	}

	return datacenter;
}
 
开发者ID:raphaeldeaquino,项目名称:mcloudsim,代码行数:53,代码来源:PSNetworkCreator.java


示例3: createDatacenter

import org.cloudbus.cloudsim.VmAllocationPolicySimple; //导入依赖的package包/类
protected static WorkflowDatacenter createDatacenter(String name) {

        // Here are the steps needed to create a PowerDatacenter:
        // 1. We need to create a list to store one or more
        //    Machines
        List<Host> hostList = new ArrayList<>();

        // 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
        //    create a list to store these PEs before creating
        //    a Machine.
        for (int i = 1; i <= 20; i++) {
            List<Pe> peList1 = new ArrayList<>();
            int mips = 2000;
            // 3. Create PEs and add these into the list.
            //for a quad-core machine, a list of 4 PEs is required:
            peList1.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
            peList1.add(new Pe(1, new PeProvisionerSimple(mips)));

            int hostId = 0;
            int ram = 2048; //host memory (MB)
            long storage = 1000000; //host storage
            int bw = 10000;
            hostList.add(
                    new Host(
                            hostId,
                            new RamProvisionerSimple(ram),
                            new BwProvisionerSimple(bw),
                            storage,
                            peList1,
                            new VmSchedulerTimeShared(peList1))); // This is our first machine
            hostId++;
        }

        // 5. Create a DatacenterCharacteristics object that stores the
        //    properties of a data center: architecture, OS, list of
        //    Machines, allocation policy: time- or space-shared, time zone
        //    and its price (G$/Pe time unit).
        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.1;	// the cost of using storage in this resource
        double costPerBw = 0.1;			// the cost of using bw in this resource
        LinkedList<Storage> storageList = new LinkedList<>();	//we are not adding SAN devices by now
        WorkflowDatacenter datacenter = null;
        DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
                arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
        // 6. Finally, we need to create a storage object.
        /**
         * The bandwidth within a data center in MB/s.
         */
        int maxTransferRate = 15;// the number comes from the futuregrid site, you can specify your bw
        try {
            HarddriveStorage s1 = new HarddriveStorage(name, 1e12);
            s1.setMaxTransferRate(maxTransferRate);
            storageList.add(s1);
            datacenter = new WorkflowDatacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return datacenter;
    }
 
开发者ID:WorkflowSim,项目名称:WorkflowSim-1.0,代码行数:65,代码来源:WorkflowSimMultipleWorkflowsExample1.java


示例4: createDatacenter

import org.cloudbus.cloudsim.VmAllocationPolicySimple; //导入依赖的package包/类
protected static WorkflowDatacenter createDatacenter(String name) {

        // Here are the steps needed to create a PowerDatacenter:
        // 1. We need to create a list to store one or more
        //    Machines
        List<Host> hostList = new ArrayList<>();

        // 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
        //    create a list to store these PEs before creating
        //    a Machine.
        for (int i = 1; i <= 20; i++) {
            List<Pe> peList1 = new ArrayList<>();
            int mips = 2000;
            // 3. Create PEs and add these into the list.
            //for a quad-core machine, a list of 4 PEs is required:
            peList1.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
            peList1.add(new Pe(1, new PeProvisionerSimple(mips)));

            int hostId = 0;
            int ram = 2048; //host memory (MB)
            long storage = 1000000; //host storage
            int bw = 10000;
            hostList.add(
                    new Host(
                            hostId,
                            new RamProvisionerSimple(ram),
                            new BwProvisionerSimple(bw),
                            storage,
                            peList1,
                            new VmSchedulerTimeShared(peList1))); // This is our first machine
            //hostId++;
        }

        // 4. Create a DatacenterCharacteristics object that stores the
        //    properties of a data center: architecture, OS, list of
        //    Machines, allocation policy: time- or space-shared, time zone
        //    and its price (G$/Pe time unit).
        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.1;	// the cost of using storage in this resource
        double costPerBw = 0.1;			// the cost of using bw in this resource
        LinkedList<Storage> storageList = new LinkedList<>();	//we are not adding SAN devices by now
        WorkflowDatacenter datacenter = null;

        DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
                arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);

        // 5. Finally, we need to create a storage object.
        /**
         * The bandwidth within a data center in MB/s.
         */
        int maxTransferRate = 15;// the number comes from the futuregrid site, you can specify your bw

        try {
            // Here we set the bandwidth to be 15MB/s
            HarddriveStorage s1 = new HarddriveStorage(name, 1e12);
            s1.setMaxTransferRate(maxTransferRate);
            storageList.add(s1);
            datacenter = new WorkflowDatacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return datacenter;
    }
 
开发者ID:WorkflowSim,项目名称:WorkflowSim-1.0,代码行数:69,代码来源:WorkflowSimBasicExample1.java


示例5: createDatacenter

import org.cloudbus.cloudsim.VmAllocationPolicySimple; //导入依赖的package包/类
/**
 * Creates a power-aware Datacenter.
 * 
 * @throws Exception
 */
public void createDatacenter() throws Exception {
	datacenter = new MyPowerDatacenter(MyConstants.DATACENTER_NAME, datacenterCharacteristics,
			new VmAllocationPolicySimple(hostList), storageList, MyConstants.DATACENTER_SCHEDULING_INTERVAL);
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:10,代码来源:Helper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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