cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-examples/src/main/java/org/cloudsimplus/examples/HostsCpuUsageExample.java
private void showCpuUtilizationForAllHosts() {
        Log.printLine("\nHosts CPU utilization history for the entire simulation period");
        int numberOfUsageHistoryEntries = 0;
        final double interval = 1;
        for (HostDynamicWorkloadSimple host : hostList) {
            double mipsByPe = host.getTotalMipsCapacity() / (double)host.getNumberOfPes();
            Log.printFormattedLine("Host %d: Number of PEs %2d, MIPS by PE %.0f", host.getId(), host.getNumberOfPes(), mipsByPe);
            for(HostStateHistoryEntry history: host.getStateHistory()){
                    numberOfUsageHistoryEntries++;
                    Log.printFormattedLine(
                            "\tTime: %2.0f CPU Utilization (MIPS): %.0f",
                            history.getTime(), history.getAllocatedMips());
            }
            Log.printLine("--------------------------------------------------");
        }
        if(numberOfUsageHistoryEntries == 0) {
            Log.printLine(" No CPU usage history was found");
        }
    }
/**
     * Shows CPU utilization of all hosts into a given Datacenter.
     */
Shows CPU utilization of all hosts into a given Datacenter.
Shows CPU utilization of all hosts into a given Datacenter .
private void showCpuUtilizationForAllHosts() {
        Log.printLine("\nHosts CPU utilization history for the entire simulation period");
        int numberOfUsageHistoryEntries = 0;
        final double interval = 1;
        for (HostDynamicWorkloadSimple host : hostList) {
            double mipsByPe = host.getTotalMipsCapacity() / (double)host.getNumberOfPes();
            Log.printFormattedLine("Host %d: Number of PEs %2d, MIPS by PE %.0f", host.getId(), host.getNumberOfPes(), mipsByPe);
            for(HostStateHistoryEntry history: host.getStateHistory()){
                    numberOfUsageHistoryEntries++;
                    Log.printFormattedLine(
                            "\tTime: %2.0f CPU Utilization (MIPS): %.0f",
                            history.getTime(), history.getAllocatedMips());
            }
            Log.printLine("--------------------------------------------------");
        }
        if(numberOfUsageHistoryEntries == 0) {
            Log.printLine(" No CPU usage history was found");
        }
    }
private void showCpuUtilizationForAllHosts ( ) { Log . printLine ( "\nHosts CPU utilization history for the entire simulation period" ) ; int numberOfUsageHistoryEntries = 0 ; final double interval = 1 ; for ( HostDynamicWorkloadSimple host : hostList ) { double mipsByPe = host . getTotalMipsCapacity ( ) / ( double ) host . getNumberOfPes ( ) ; Log . printFormattedLine ( "Host %d: Number of PEs %2d, MIPS by PE %.0f" , host . getId ( ) , host . getNumberOfPes ( ) , mipsByPe ) ; for ( HostStateHistoryEntry history : host . getStateHistory ( ) ) { numberOfUsageHistoryEntries ++ ; Log . printFormattedLine ( "\tTime: %2.0f CPU Utilization (MIPS): %.0f" , history . getTime ( ) , history . getAllocatedMips ( ) ) ; } Log . printLine ( "--------------------------------------------------" ) ; } if ( numberOfUsageHistoryEntries == 0 ) { Log . printLine ( " No CPU usage history was found" ) ; } }
Shows CPU utilization of all hosts into a given Datacenter.
Shows CPU utilization of all hosts into a given Datacenter .