Examples of ArithmeticMeanCalculator


Examples of org.rhq.server.metrics.ArithmeticMeanCalculator

    private AggregateNumericMetric computeAggregateFromRaw(List<RawNumericMetric> rawMetrics,
        AggregateNumericMetric metric) {
        double min = Double.NaN;
        double max = min;
        int count = 0;
        ArithmeticMeanCalculator mean = new ArithmeticMeanCalculator();
        double value;

        for (RawNumericMetric rawMetric : rawMetrics) {
            value = rawMetric.getValue();
            if (count == 0) {
                min = value;
                max = min;
            }
            if (value < min) {
                min = value;
            } else if (value > max) {
                max = value;
            }
            mean.add(value);
            ++count;
        }

        // We let the caller handle setting the schedule id because in some cases we do
        // not care about it.
        return new AggregateNumericMetric(metric.getScheduleId(), metric.getBucket(), mean.getArithmeticMean(), min,
            max, metric.getTimestamp());
    }
View Full Code Here

Examples of org.rhq.server.metrics.ArithmeticMeanCalculator

    private AggregateNumericMetric computeAggregate(List<AggregateNumericMetric> metrics, int scheduleId,
        long timestamp, Bucket bucket) {
        double min = Double.NaN;
        double max = min;
        int count = 0;
        ArithmeticMeanCalculator mean = new ArithmeticMeanCalculator();

        for (AggregateNumericMetric metric : metrics) {
            if (count == 0) {
                min = metric.getMin();
                max = metric.getMax();
            }
            if (metric.getMin() < min) {
                min = metric.getMin();
            }
            if (metric.getMax() > max) {
                max = metric.getMax();
            }
            mean.add(metric.getAvg());
            ++count;
        }

        // We let the caller handle setting the schedule id because in some cases we do
        // not care about it.
        return new AggregateNumericMetric(scheduleId, bucket, mean.getArithmeticMean(), min, max, timestamp);
    }
View Full Code Here

Examples of org.rhq.server.metrics.ArithmeticMeanCalculator

        Iterator<T> iterator = metrics.iterator();
        T metric = iterator.next();
        int scheduleId = metric.getScheduleId();
        Double min = metric.getMin();
        Double max = metric.getMax();
        ArithmeticMeanCalculator mean = new ArithmeticMeanCalculator();
        mean.add(metric.getAvg());

        while (iterator.hasNext()) {
            metric = iterator.next();
            mean.add(metric.getAvg());
            if (metric.getMin() < min) {
                min = metric.getMin();
            }
            if (metric.getMax() > max) {
                max = metric.getMax();
            }
        }
        return new AggregateNumericMetric(scheduleId, bucket, mean.getArithmeticMean(), min, max, timeSlice);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.