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


Java Log.isDisabled方法代码示例

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


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

示例1: printOverUtilizedHosts

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Prints the over utilized hosts.
 * 
 * @param overUtilizedHosts the over utilized hosts
 */
protected void printOverUtilizedHosts(List<PowerHostUtilizationHistory> overUtilizedHosts) {
	if (!Log.isDisabled()) {
		Log.printLine("Over-utilized hosts:");
		for (PowerHostUtilizationHistory host : overUtilizedHosts) {
			Log.printLine("Host #" + host.getId());
		}
		Log.printLine();
	}
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:15,代码来源:PowerVmAllocationPolicyMigrationAbstract.java

示例2: submitCloudlets

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Submit cloudlets to the created VMs.
 * 
 * @see #submitCloudletList(java.util.List)
 */
// OK
@Override
protected void submitCloudlets() {
	List<Cloudlet> successfullySubmitted = new ArrayList<Cloudlet>();

	for (Cloudlet cloudlet : getCloudletList()) {
		Vm vm = VmList.getById(getVmsCreatedList(), cloudlet.getVmId());
		if (vm == null) { // vm was not created
			if (!Log.isDisabled()) {
				Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Postponing execution of cloudlet ",
						cloudlet.getCloudletId(), ": bount VM not available");
			}
			continue;
		}

		if (!Log.isDisabled()) {
			Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Scheduling input cloudlet ",
					cloudlet.getCloudletId(), " to VM #", vm.getId(), " on ",
					((PSCloudlet) cloudlet).getArrivalTime());
		}

		// The cloudlet starts its execution only after data transfer
		send(getVmsToDatacentersMap().get(vm.getId()), ((PSCloudlet) cloudlet).getArrivalTime() - CloudSim.clock(),
				CloudSimTags.CLOUDLET_SUBMIT, cloudlet);
		cloudletsSubmitted++;
		getCloudletSubmittedList().add(cloudlet);
		successfullySubmitted.add(cloudlet);
	}

	// remove submitted cloudlets from waiting list
	getCloudletList().removeAll(successfullySubmitted);

	initPathBrokersMap();
	scheduleIntermittence();
}
 
开发者ID:raphaeldeaquino,项目名称:mcloudsim,代码行数:41,代码来源:PSDatacenterBroker.java

示例3: getMigrationMapFromUnderUtilizedHosts

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * Gets the migration map from under utilized hosts.
 * 
 * @param overUtilizedHosts the over utilized hosts
 * @return the migration map from under utilized hosts
 */
protected List<Map<String, Object>> getMigrationMapFromUnderUtilizedHosts(
		List<PowerHostUtilizationHistory> overUtilizedHosts) {
	List<Map<String, Object>> migrationMap = new LinkedList<Map<String, Object>>();
	List<PowerHost> switchedOffHosts = getSwitchedOffHosts();

	// over-utilized hosts + hosts that are selected to migrate VMs to from over-utilized hosts
	Set<PowerHost> excludedHostsForFindingUnderUtilizedHost = new HashSet<PowerHost>();
	excludedHostsForFindingUnderUtilizedHost.addAll(overUtilizedHosts);
	excludedHostsForFindingUnderUtilizedHost.addAll(switchedOffHosts);
	excludedHostsForFindingUnderUtilizedHost.addAll(extractHostListFromMigrationMap(migrationMap));

	// over-utilized + under-utilized hosts
	Set<PowerHost> excludedHostsForFindingNewVmPlacement = new HashSet<PowerHost>();
	excludedHostsForFindingNewVmPlacement.addAll(overUtilizedHosts);
	excludedHostsForFindingNewVmPlacement.addAll(switchedOffHosts);

	int numberOfHosts = getHostList().size();

	while (true) {
		if (numberOfHosts == excludedHostsForFindingUnderUtilizedHost.size()) {
			break;
		}

		PowerHost underUtilizedHost = getUnderUtilizedHost(excludedHostsForFindingUnderUtilizedHost);
		if (underUtilizedHost == null) {
			break;
		}

		Log.printLine("Under-utilized host: host #" + underUtilizedHost.getId() + "\n");

		excludedHostsForFindingUnderUtilizedHost.add(underUtilizedHost);
		excludedHostsForFindingNewVmPlacement.add(underUtilizedHost);

		List<? extends Vm> vmsToMigrateFromUnderUtilizedHost = getVmsToMigrateFromUnderUtilizedHost(underUtilizedHost);
		if (vmsToMigrateFromUnderUtilizedHost.isEmpty()) {
			continue;
		}

		Log.print("Reallocation of VMs from the under-utilized host: ");
		if (!Log.isDisabled()) {
			for (Vm vm : vmsToMigrateFromUnderUtilizedHost) {
				Log.print(vm.getId() + " ");
			}
		}
		Log.printLine();

		List<Map<String, Object>> newVmPlacement = getNewVmPlacementFromUnderUtilizedHost(
				vmsToMigrateFromUnderUtilizedHost,
				excludedHostsForFindingNewVmPlacement);

		excludedHostsForFindingUnderUtilizedHost.addAll(extractHostListFromMigrationMap(newVmPlacement));

		migrationMap.addAll(newVmPlacement);
		Log.printLine();
	}

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

示例4: getMigrationMapFromUnderUtilizedHosts

import org.cloudbus.cloudsim.Log; //导入方法依赖的package包/类
/**
 * 
 * Gets the migration map from under utilized hosts.
 * 
 * @param overUtilizedHosts the over utilized hosts
 * @return the migration map from under utilized hosts
 */
protected List<Map<String, Object>> getMigrationMapFromUnderUtilizedHosts(
		List<PowerHostUtilizationHistory> overUtilizedHosts) {
	List<Map<String, Object>> migrationMap = new LinkedList<Map<String, Object>>();
	List<PowerHost> switchedOffHosts = getSwitchedOffHosts();//关闭的Host

	// over-utilized hosts + hosts that are selected to migrate VMs to from over-utilized hosts
	// 排除在欠载列表之外的Host列表,显然上一步找到的过载Host肯定不在潜在列表中,还有关闭的Host也在排除列表之内
	Set<PowerHost> excludedHostsForFindingUnderUtilizedHost = new HashSet<PowerHost>();
	excludedHostsForFindingUnderUtilizedHost.addAll(overUtilizedHosts);
	excludedHostsForFindingUnderUtilizedHost.addAll(switchedOffHosts);
	excludedHostsForFindingUnderUtilizedHost.addAll(extractHostListFromMigrationMap(migrationMap));

	// over-utilized + under-utilized hosts
	// 排除在虚拟机迁移列表之外的Host,显然过载的Host肯定不在虚拟机可以迁移的Host之内,关闭的Host也在排除列表之内
	Set<PowerHost> excludedHostsForFindingNewVmPlacement = new HashSet<PowerHost>();
	excludedHostsForFindingNewVmPlacement.addAll(overUtilizedHosts);
	excludedHostsForFindingNewVmPlacement.addAll(switchedOffHosts);

	int numberOfHosts = getHostList().size();

	while (true) {
		// 如果Host都是在排除列表之外,那么退出循环
		if (numberOfHosts == excludedHostsForFindingUnderUtilizedHost.size()) {
			break;
		}
		
		PowerHost underUtilizedHost = getUnderUtilizedHost(excludedHostsForFindingUnderUtilizedHost);
		if (underUtilizedHost == null) {
			break;
		}

		Log.printLine("Under-utilized host: host #" + underUtilizedHost.getId() + "\n");
		//把找到的欠载host加入到欠载排除列表和虚拟机放置排除列表中
		excludedHostsForFindingUnderUtilizedHost.add(underUtilizedHost);
		excludedHostsForFindingNewVmPlacement.add(underUtilizedHost);
		
		//将欠载Host中的可以迁移的虚拟机列表返回
		List<? extends Vm> vmsToMigrateFromUnderUtilizedHost = getVmsToMigrateFromUnderUtilizedHost(underUtilizedHost);
		if (vmsToMigrateFromUnderUtilizedHost.isEmpty()) {
			continue;
		}

		Log.print("Reallocation of VMs from the under-utilized host: ");
		if (!Log.isDisabled()) {
			for (Vm vm : vmsToMigrateFromUnderUtilizedHost) {
				Log.print(vm.getId() + " ");
			}
		}
		Log.printLine();
		// 在欠载Host中,对可以迁移的虚拟机进行迁移
		List<Map<String, Object>> newVmPlacement = getNewVmPlacementFromUnderUtilizedHost(
				vmsToMigrateFromUnderUtilizedHost,
				excludedHostsForFindingNewVmPlacement);

		excludedHostsForFindingUnderUtilizedHost.addAll(extractHostListFromMigrationMap(newVmPlacement));

		migrationMap.addAll(newVmPlacement);
		Log.printLine();
	}
	//返回迁移的映射表
	return migrationMap;
}
 
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:70,代码来源:PowerVmAllocationPolicyMigrationAbstract.java


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