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


Java Datacenter.printDebts方法代码示例

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


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

示例1: main

import org.cloudbus.cloudsim.Datacenter; //导入方法依赖的package包/类
/**
 * Creates main() to run this example
 */
public static void main(String[] args) {
	Log.printLine("Starting CloudSimExample6...");

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

		// Initialize the CloudSim library
		CloudSim.init(num_user, calendar, trace_flag);

		// 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");
		Datacenter datacenter1 = createDatacenter("Datacenter_1");

		//Third step: Create Broker
		DatacenterBroker broker = createBroker();
		int brokerId = broker.getId();

		//Fourth step: Create VMs and Cloudlets and send them to broker
		vmlist = createVM(brokerId,20); //creating 20 vms
		cloudletList = createCloudlet(brokerId,40); // creating 40 cloudlets

		broker.submitVmList(vmlist);
		broker.submitCloudletList(cloudletList);

		// Fifth step: Starts the simulation
		CloudSim.startSimulation();

		// Final step: Print results when simulation is over
		List<Cloudlet> newList = broker.getCloudletReceivedList();

		CloudSim.stopSimulation();

		printCloudletList(newList);

		//Print the debt of each user to each datacenter
		datacenter0.printDebts();
		datacenter1.printDebts();

		Log.printLine("CloudSimExample6 finished!");
	}
	catch (Exception e)
	{
		e.printStackTrace();
		Log.printLine("The simulation has been terminated due to an unexpected error");
	}
}
 
开发者ID:marcbux,项目名称:dynamiccloudsim,代码行数:55,代码来源:CloudSimExample6.java

示例2: main

import org.cloudbus.cloudsim.Datacenter; //导入方法依赖的package包/类
/**
 * Creates main() to run this example
 */
public static void main(String[] args) {
	Log.printLine("Starting CloudSimExample8...");

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

		// Initialize the CloudSim library
		CloudSim.init(num_user, calendar, trace_flag);

		GlobalBroker globalBroker = new GlobalBroker("GlobalBroker");

		// 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");
		Datacenter datacenter1 = createDatacenter("Datacenter_1");

		//Third step: Create Broker
		DatacenterBroker broker = createBroker("Broker_0");
		int brokerId = broker.getId();

		//Fourth step: Create VMs and Cloudlets and send them to broker
		vmList = createVM(brokerId, 5, 0); //creating 5 vms
		cloudletList = createCloudlet(brokerId, 10, 0); // creating 10 cloudlets

		broker.submitVmList(vmList);
		broker.submitCloudletList(cloudletList);

		// Fifth step: Starts the simulation
		CloudSim.startSimulation();

		// Final step: Print results when simulation is over
		List<Cloudlet> newList = broker.getCloudletReceivedList();
		newList.addAll(globalBroker.getBroker().getCloudletReceivedList());

		CloudSim.stopSimulation();

		printCloudletList(newList);

		//Print the debt of each user to each datacenter
		datacenter0.printDebts();
		datacenter1.printDebts();

		Log.printLine("CloudSimExample8 finished!");
	}
	catch (Exception e)
	{
		e.printStackTrace();
		Log.printLine("The simulation has been terminated due to an unexpected error");
	}
}
 
开发者ID:marcbux,项目名称:dynamiccloudsim,代码行数:58,代码来源:CloudSimExample8.java

示例3: main

import org.cloudbus.cloudsim.Datacenter; //导入方法依赖的package包/类
/**
 * Creates main() to run this example
 */
public static void main(String[] args) {
	Log.printLine("Starting CloudSimExample8...");

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

		// Initialize the CloudSim library
		CloudSim.init(num_user, calendar, trace_flag);

		//GlobalBroker globalBroker = new GlobalBroker("GlobalBroker");

		// 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");
		Datacenter datacenter1 = createDatacenter("Datacenter_1");

		//Third step: Create Broker
		DatacenterBroker broker = createBroker("Broker_0");
		int brokerId = broker.getId();

		//Fourth step: Create VMs and Cloudlets and send them to broker
		vmList = createVM(brokerId, 5, 0); //creating 5 vms
		cloudletList = createCloudlet(brokerId, 10, 0); // creating 10 cloudlets

		broker.submitVmList(vmList);
		broker.submitCloudletList(cloudletList);

		// Fifth step: Starts the simulation
		CloudSim.startSimulation();

		// Final step: Print results when simulation is over
		List<Cloudlet> newList = broker.getCloudletReceivedList();
		//newList.addAll(globalBroker.getBroker().getCloudletReceivedList());

		CloudSim.stopSimulation();

		printCloudletList(newList);

		//Print the debt of each user to each datacenter
		datacenter0.printDebts();
		datacenter1.printDebts();

		Log.printLine(CloudSimExample9.class.getName() + " finished!");
	}
	catch (Exception e)
	{
		e.printStackTrace();
		Log.printLine("The simulation has been terminated due to an unexpected error");
	}
}
 
开发者ID:hewolf,项目名称:VirtualMachinePlacement,代码行数:58,代码来源:CloudSimExample9.java


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