0

尊敬的研究人员,我想计算云数据中心中物理服务器的虚拟机消耗的功率。请帮助我,我将非常感谢您的赞赏。

4

2 回答 2

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 .line 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 行

于 2018-12-27T10:39:09.000 回答
0

CloudSim Plus 具有计算 VM 功耗的内置功能。下面的方法展示了如何使用这样的功能。您可以在此处获得完整的示例。

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();
    }
}
于 2019-04-18T19:23:42.943 回答