受过尊敬的研究人员,我想计算云数据中心中物理服务器的虚拟机消耗的功率。 请帮助我,我将非常感谢您的感谢。
答案 0 :(得分:0)
/**
* The cost of each byte of bandwidth (bw) consumed.
*/
protected double costPerBw;
/**
* The total bandwidth (bw) cost for transferring the cloudlet by the
* network, according to the {@link #cloudletFileSize}.
*/
protected double accumulatedBwCost;
// Utilization
/**
* The utilization model that defines how the cloudlet will use the VM's
* CPU.
此段摘自Cloudlet.java第212行。这可能会有所帮助。
或者,通过设置每个VM属性,您可以计算功耗。
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 2048; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
此段摘自CloudSimExample3.java第64行
答案 1 :(得分:0)
CloudSim Plus具有内置功能,可以计算VM的功耗。 下面的方法显示了如何使用这种功能。您可以获取完整的示例here。
private void printVmsCpuUtilizationAndPowerConsumption() {
for (Vm vm : vmList) {
System.out.println("Vm " + vm.getId() + " at Host " + vm.getHost().getId() + " CPU Usage and Power Consumption");
double vmPower; //watt-sec
double utilizationHistoryTimeInterval, prevTime = 0;
final UtilizationHistory history = vm.getUtilizationHistory();
for (final double time : history.getHistory().keySet()) {
utilizationHistoryTimeInterval = time - prevTime;
vmPower = history.vmPowerConsumption(time);
final double wattsPerInterval = vmPower*utilizationHistoryTimeInterval;
System.out.printf(
"\tTime %8.1f | Host CPU Usage: %6.1f%% | Power Consumption: %8.0f Watt-Sec * %6.0f Secs = %10.2f Watt-Sec\n",
time, history.vmCpuUsageFromHostCapacity(time) *100, vmPower, utilizationHistoryTimeInterval, wattsPerInterval);
prevTime = time;
}
System.out.println();
}
}