/** * Gets the host utilization MAD. * * @param host the host * @return the host utilization MAD */ protected double getHostUtilizationMad(PowerHostUtilizationHistory host) throws IllegalArgumentException { double[] data = host.getUtilizationHistory(); if (MathUtil.countNonZeroBeginning(data) >= 12) { // 12 has been suggested as a safe value return MathUtil.mad(data); } throw new IllegalArgumentException(); }
/** * Computes the host utilization MAD used for generating the host over utilization threshold. * * @param host the host * @return the host utilization MAD * @throws {@inheritDoc} */ @Override public double computeHostUtilizationMeasure(final Host host) throws IllegalArgumentException { final double[] cpuUsageArray = getHostCpuUsageArray(host); if (MathUtil.countNonZeroBeginning(cpuUsageArray) >= MIN_HISTORY_ENTRIES_FOR_MAD) { return MathUtil.mad(cpuUsageArray); } throw new IllegalArgumentException("There is not enough Host history to compute Host utilization MAD"); }