cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/hosts/HostDynamicWorkloadSimple.java
private double addVmResourceUseToHistoryIfNotMigratingIn(Vm vm, double currentTime) {
        double totalAllocatedMips = getVmScheduler().getTotalAllocatedMipsForVm(vm);
        if (getVmsMigratingIn().contains(vm)) {
            Log.printFormattedLine("%.2f: [" + this + "] " + vm
                    + " is migrating in", getSimulation().clock());
            return totalAllocatedMips;
        }

        final double totalRequestedMips = vm.getCurrentRequestedTotalMips();
        if (totalAllocatedMips + 0.1 < totalRequestedMips) {
            final String reason = getVmsMigratingOut().contains(vm) ? "migration overhead" : "capacity unavailability";
            final double notAllocatedMipsByPe = (totalRequestedMips - totalAllocatedMips)/vm.getNumberOfPes();
            Log.printFormattedLine(
                "%.2f: [%s] %.0f MIPS not allocated for each one of the %d PEs from %s due to %s.",
                getSimulation().clock(), this, notAllocatedMipsByPe, vm.getNumberOfPes(), vm, reason);
        }

        final VmStateHistoryEntry entry = new VmStateHistoryEntry(
                currentTime,
                totalAllocatedMips,
                totalRequestedMips,
                vm.isInMigration() && !getVmsMigratingIn().contains(vm));
        vm.addStateHistoryEntry(entry);

        if (vm.isInMigration()) {
            Log.printFormattedLine(
                    "%.2f: [" + this + "] " + vm + " is migrating out ",
                    getSimulation().clock());
            totalAllocatedMips /= getVmScheduler().getMaxCpuUsagePercentDuringOutMigration();
        }

        return totalAllocatedMips;
    }
/**
     * Adds the VM resource usage to the History if the VM is not migrating into the Host.
     * @param vm the VM to add its usage to the history
     * @param currentTime the current simulation time
     * @return the total allocated MIPS for the given VM
     */
Adds the VM resource usage to the History if the VM is not migrating into the Host.
@param vm the VM to add its usage to the history
@param currentTime the current simulation time
@return the total allocated MIPS for the given VM
Adds the VM resource usage to the History if the VM is not migrating into the Host . @param vm the VM to add its usage to the history @param currentTime the current simulation time @return the total allocated MIPS for the given VM
private double addVmResourceUseToHistoryIfNotMigratingIn(Vm vm, double currentTime) {
        double totalAllocatedMips = getVmScheduler().getTotalAllocatedMipsForVm(vm);
        if (getVmsMigratingIn().contains(vm)) {
            Log.printFormattedLine("%.2f: [" + this + "] " + vm
                    + " is migrating in", getSimulation().clock());
            return totalAllocatedMips;
        }
        final double totalRequestedMips = vm.getCurrentRequestedTotalMips();
        if (totalAllocatedMips + 0.1 < totalRequestedMips) {
            final String reason = getVmsMigratingOut().contains(vm) ? "migration overhead" : "capacity unavailability";
            final double notAllocatedMipsByPe = (totalRequestedMips - totalAllocatedMips)/vm.getNumberOfPes();
            Log.printFormattedLine(
                "%.2f: [%s] %.0f MIPS not allocated for each one of the %d PEs from %s due to %s.",
                getSimulation().clock(), this, notAllocatedMipsByPe, vm.getNumberOfPes(), vm, reason);
        }
        final VmStateHistoryEntry entry = new VmStateHistoryEntry(
                currentTime,
                totalAllocatedMips,
                totalRequestedMips,
                vm.isInMigration() && !getVmsMigratingIn().contains(vm));
        vm.addStateHistoryEntry(entry);
        if (vm.isInMigration()) {
            Log.printFormattedLine(
                    "%.2f: [" + this + "] " + vm + " is migrating out ",
                    getSimulation().clock());
            totalAllocatedMips /= getVmScheduler().getMaxCpuUsagePercentDuringOutMigration();
        }
        return totalAllocatedMips;
    }
private double addVmResourceUseToHistoryIfNotMigratingIn ( Vm vm , double currentTime ) { double totalAllocatedMips = getVmScheduler ( ) . getTotalAllocatedMipsForVm ( vm ) ; if ( getVmsMigratingIn ( ) . contains ( vm ) ) { Log . printFormattedLine ( "%.2f: [" + this + "] " + vm + " is migrating in" , getSimulation ( ) . clock ( ) ) ; return totalAllocatedMips ; } final double totalRequestedMips = vm . getCurrentRequestedTotalMips ( ) ; if ( totalAllocatedMips + 0.1 < totalRequestedMips ) { final String reason = getVmsMigratingOut ( ) . contains ( vm ) ? "migration overhead" : "capacity unavailability" ; final double notAllocatedMipsByPe = ( totalRequestedMips - totalAllocatedMips ) / vm . getNumberOfPes ( ) ; Log . printFormattedLine ( "%.2f: [%s] %.0f MIPS not allocated for each one of the %d PEs from %s due to %s." , getSimulation ( ) . clock ( ) , this , notAllocatedMipsByPe , vm . getNumberOfPes ( ) , vm , reason ) ; } final VmStateHistoryEntry entry = new VmStateHistoryEntry ( currentTime , totalAllocatedMips , totalRequestedMips , vm . isInMigration ( ) && ! getVmsMigratingIn ( ) . contains ( vm ) ) ; vm . addStateHistoryEntry ( entry ) ; if ( vm . isInMigration ( ) ) { Log . printFormattedLine ( "%.2f: [" + this + "] " + vm + " is migrating out " , getSimulation ( ) . clock ( ) ) ; totalAllocatedMips /= getVmScheduler ( ) . getMaxCpuUsagePercentDuringOutMigration ( ) ; } return totalAllocatedMips ; }
Adds the VM resource usage to the History if the VM is not migrating into the Host.
Adds the VM resource usage to the History if the VM is not migrating into the Host .