cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-examples/src/main/java/org/cloudbus/cloudsim/examples/power/util/Helper.java
private void compute() {
            for (final VmStateHistoryEntry entry : vm.getStateHistory()) {
                if (previousTime != -1) {
                    double timeDiff = entry.getTime() - previousTime;
                    totalAllocatedMips += previousAllocatedMips * timeDiff;
                    totalRequestedMips += previousRequestedMips * timeDiff;

                    if (previousAllocatedMips < previousRequestedMips) {
                        slaViolation.add((previousRequestedMips - previousAllocatedMips) / previousRequestedMips);
                        if (previousIsInMigration) {
                            underAllocatedMipsDueToMigration +=
                                (previousRequestedMips - previousAllocatedMips) * timeDiff;
                        }
                    }
                }

                previousAllocatedMips = entry.getAllocatedMips();
                previousRequestedMips = entry.getRequestedMips();
                previousTime = entry.getTime();
                previousIsInMigration = entry.isInMigration();
            }
        }
/**
         * Computes some SLA metrics for the VM, based on
         * its MIPS history.
         */
Computes some SLA metrics for the VM, based on
its MIPS history.
Computes some SLA metrics for the VM based on its MIPS history .
private void compute() {
            for (final VmStateHistoryEntry entry : vm.getStateHistory()) {
                if (previousTime != -1) {
                    double timeDiff = entry.getTime() - previousTime;
                    totalAllocatedMips += previousAllocatedMips * timeDiff;
                    totalRequestedMips += previousRequestedMips * timeDiff;
                    if (previousAllocatedMips < previousRequestedMips) {
                        slaViolation.add((previousRequestedMips - previousAllocatedMips) / previousRequestedMips);
                        if (previousIsInMigration) {
                            underAllocatedMipsDueToMigration +=
                                (previousRequestedMips - previousAllocatedMips) * timeDiff;
                        }
                    }
                }
                previousAllocatedMips = entry.getAllocatedMips();
                previousRequestedMips = entry.getRequestedMips();
                previousTime = entry.getTime();
                previousIsInMigration = entry.isInMigration();
            }
        }
private void compute ( ) { for ( final VmStateHistoryEntry entry : vm . getStateHistory ( ) ) { if ( previousTime != - 1 ) { double timeDiff = entry . getTime ( ) - previousTime ; totalAllocatedMips += previousAllocatedMips * timeDiff ; totalRequestedMips += previousRequestedMips * timeDiff ; if ( previousAllocatedMips < previousRequestedMips ) { slaViolation . add ( ( previousRequestedMips - previousAllocatedMips ) / previousRequestedMips ) ; if ( previousIsInMigration ) { underAllocatedMipsDueToMigration += ( previousRequestedMips - previousAllocatedMips ) * timeDiff ; } } } previousAllocatedMips = entry . getAllocatedMips ( ) ; previousRequestedMips = entry . getRequestedMips ( ) ; previousTime = entry . getTime ( ) ; previousIsInMigration = entry . isInMigration ( ) ; } }
Computes some SLA metrics for the VM, based on
 its MIPS history.
Computes some SLA metrics for the VM based on its MIPS history .