У меня есть следующий код. Я хочу увеличить переменную slaViolationTimePerHost, когда один из (cpu или ram) больше или заполнен, чем другой, в соответствии с этим условием previousAllocated
double slaViolationTimePerHost = 0;
double previousAllocated = 0;
double previousRequested = 0;
for (HostStateHistoryEntry entry : host.getStateHistory()) {
if (previousTime != -1 && previousIsActive) {
double timeDiff = entry.getTime() - previousTime;
totalTime += timeDiff;
// Here is my question, How should I undrestand which one (cpu, ram)
// is greater or full according the following codition.
// if(previousAllocatedCpu < previousRequestedCpu)
// if(previousAllocatedRam < previousRequestedRam)
if (previousAllocated < previousRequested) {
slaViolationTimePerHost += timeDiff;
}
}
double previousAllocatedCpu = entry.getAllocatedMips();
double previousAllocatedRam = entry.getAllocatedRam();
double previousRequestedCpu = entry.getAllocatedMips();
double previousRequestedRam = entry.getRequestedRam();
previousTime = entry.getTime();
previousIsActive = entry.isActive();
}