Package org.apache.commons.math3.stat.descriptive.moment

Examples of org.apache.commons.math3.stat.descriptive.moment.StandardDeviation


    public void displayStatistics(Sample[] samples, int threadNo) {
        long start = Long.MAX_VALUE;
        long finish = 0;
       
        Mean mean = new Mean();
        StandardDeviation stdDev = new StandardDeviation();
        Skewness skewness = new Skewness();
       
        int n = 0;
        for(Sample sample: samples) {
            if (threadNo == -1 || threadNo == sample.threadId) {
                n++;
                if (sample.timestamp < start) {
                    start = sample.timestamp;
                }
                if (sample.timestamp + sample.duration > finish) {
                    finish = sample.timestamp + sample.duration;
                }
                mean.increment(sample.duration);
                stdDev.increment(sample.duration);
                skewness.increment(sample.duration);
            }
        }
       
        double throughPut = (double)n * (double)TimeUnit.SECONDS.toNanos(1) / (double)(finish - start);
       
        System.out.println(String.format("Mean(NS)    %.1f", mean.getResult()));
        System.out.println(String.format("StdDev(NS)  %.1f", stdDev.getResult()));
        System.out.println(String.format("Skew(NS)    %.1f", skewness.getResult()));
        System.out.println(String.format("Throughput  %.1f", throughPut));
        System.out.println(String.format("Total time  %.3f", (finish - start) / (double)TimeUnit.SECONDS.toNanos(1)));
       
    }
View Full Code Here


        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation();
        return stdDev.evaluate(values);
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation(false);
        return stdDev.evaluate(values);
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation(false);
        return stdDev.evaluate(values);
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation();
        return stdDev.evaluate(values);
    }
View Full Code Here

            }
        }
    }

    protected void printStat(String label, double[] values) {
        StandardDeviation standardDeviation = new StandardDeviation();
        System.out.println(label + ":");
        System.out.println(String.format("  mean : %.2f", StatUtils.mean(values)));
        System.out.println(String.format("  min  : %.2f", StatUtils.min(values)));
        System.out.println(String.format("  max  : %.2f", StatUtils.max(values)));
        System.out.println(String.format("  stdev: %.2f", standardDeviation.evaluate(values)));
        System.out.println("");
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation();
        return stdDev.evaluate(values);
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation(false);
        return stdDev.evaluate(values);
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation();
        return stdDev.evaluate(values);
    }
View Full Code Here

        double[] values = new double[length];
        for (int i = 0; i < length; i++) {
            values[i] = start + i;
        }

        StandardDeviation stdDev = new StandardDeviation(false);
        return stdDev.evaluate(values);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.stat.descriptive.moment.StandardDeviation

Copyright © 2018 www.massapicom. 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.