CloudSim仿真流程研究(二)

本文探讨了CloudSim库中IqrMc例子的运行过程,重点关注如何创建随机Cloudlet并模拟CPU、RAM和BW利用率。在powerDatacenter类中添加利用率输出代码,通过HostDynamicWorkload和Host类修改利用率计算,解决利用率在后续时钟时间显示为0的问题,实现了在每个时钟时间正确输出资源利用率的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

org.cloudbus.cloudsim.examples.power.random里的例子IqrMc

public class IqrMc {

	/**
	 * The main method.
	 * 
	 * @param args the arguments
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	public static void main(String[] args) throws IOException {
		boolean enableOutput = true;
		boolean outputToFile = true;
		String inputFolder = "";
		String outputFolder = "C:\\Users\\yangdi\\Desktop\\cloudsim_data";
		String workload = "random"; // Random workload
		String vmAllocationPolicy = "iqr"; // Inter Quartile Range (IQR) VM allocation policy
		String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy
		String parameter = "1.5"; // the safety parameter of the IQR policy
		
		new RandomRunner(
				enableOutput,
				outputToFile,
				inputFolder,
				outputFolder,
				workload,
				vmAllocationPolicy,
				vmSelectionPolicy,
				parameter);
	}

}

运行类在类RandomRunner中,该类继承于RunnerAbstract类,并且直重写了一个方法:init()

protected void init(String inputFolder) {
		try {
			CloudSim.init(1, Calendar.getInstance(), false);

			broker = Helper.createBroker();
			int broker
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值