From: <pn...@hy...> - 2010-03-29 21:29:55
|
Author: pnguyen Date: 2010-03-29 14:29:47 -0700 (Mon, 29 Mar 2010) New Revision: 14436 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14436 Modified: trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java Log: [HHQ-3803] Init total to 0, not 1. Modified: trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java =================================================================== --- trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java 2010-03-29 21:22:09 UTC (rev 14435) +++ trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java 2010-03-29 21:29:47 UTC (rev 14436) @@ -178,9 +178,9 @@ return null; } - double high = Double.MIN_VALUE, - low = Double.MAX_VALUE, - total = 1; + double high = Double.MIN_VALUE; + double low = Double.MAX_VALUE; + double total = 0; Double lastVal = null; int count = 0; long last = Long.MIN_VALUE; @@ -193,8 +193,6 @@ final int currentCount = mv.getCount(); final long currentTimestamp = mv.getTimestamp(); - if (debug) log.debug("Low: " + currentLowValue + ", High: " + currentHighValue + ", Value: " + currentValue + ", Count: " + currentCount + ", Timestamp: " + currentTimestamp); - if (!Double.isNaN(currentLowValue) && !Double.isInfinite(currentLowValue)) { low = Math.min(mv.getLowValue(), low); } @@ -212,6 +210,20 @@ if (!Double.isNaN(currentValue) && !Double.isInfinite(currentValue)) { total += currentValue * currentCount; } + + if (debug) { + log.debug("Measurement=" + template.getName() + + ", Current {Low=" + currentLowValue + + ", High=" + currentHighValue + + ", Value=" + currentValue + + ", Count=" + currentCount + + ", Timestamp=" + currentTimestamp + + "}, Summary {Low=" + low + + ", High=" + high + + ", Total=" + total + + ", Count=" + count + + "}"); + } } // This should only happen if every value in the array is NaN/Infinity... @@ -253,6 +265,17 @@ data[MeasurementConstants.IND_LAST_TIME] = lastVal; } + if (debug) { + log.debug("Measurement=" + template.getName() + + ", Last {Value=" + lastVal + + "}, Summary {Avg=" + avg + + ", Low=" + low + + ", High=" + high + + ", Total=" + total + + ", Count=" + count + + "}"); + } + return data; } |