Examples of PercentileSnapshot


Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

            fail("We expect to see some high values over 400 but got: " + p.getPercentile(99));
        }
    }

    public PercentileSnapshot getPercentileForValues(int... values) {
        PercentileSnapshot p = new PercentileSnapshot(values);
        return p;
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        return p;
    }

    @Test
    public void testPercentileAlgorithm_Median1() {
        PercentileSnapshot list = new PercentileSnapshot(100, 100, 100, 100, 200, 200, 200, 300, 300, 300, 300);
        Assert.assertEquals(200, list.getPercentile(50));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(200, list.getPercentile(50));
    }

    @Test
    public void testPercentileAlgorithm_Median2() {
        PercentileSnapshot list = new PercentileSnapshot(100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 500);
        Assert.assertEquals(100, list.getPercentile(50));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(100, list.getPercentile(50));
    }

    @Test
    public void testPercentileAlgorithm_Median3() {
        PercentileSnapshot list = new PercentileSnapshot(50, 75, 100, 125, 160, 170, 180, 200, 210, 300, 500);
        //            list.addValue(50); // 1
        //            list.addValue(75); // 2
        //            list.addValue(100); // 3
        //            list.addValue(125); // 4
        //            list.addValue(160); // 5
        //            list.addValue(170); // 6
        //            list.addValue(180); // 7
        //            list.addValue(200); // 8
        //            list.addValue(210); // 9
        //            list.addValue(300); // 10
        //            list.addValue(500); // 11

        Assert.assertEquals(175, list.getPercentile(50));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(175, list.getPercentile(50));
    }

    @Test
    public void testPercentileAlgorithm_Median4() {
        PercentileSnapshot list = new PercentileSnapshot(300, 75, 125, 500, 100, 160, 180, 200, 210, 50, 170);
        // unsorted so it is expected to sort it for us
        //            list.addValue(300); // 10
        //            list.addValue(75); // 2
        //            list.addValue(125); // 4
        //            list.addValue(500); // 11
        //            list.addValue(100); // 3
        //            list.addValue(160); // 5
        //            list.addValue(180); // 7
        //            list.addValue(200); // 8
        //            list.addValue(210); // 9
        //            list.addValue(50); // 1
        //            list.addValue(170); // 6

        Assert.assertEquals(175, list.getPercentile(50));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(175, list.getPercentile(50));
    }

    @Test
    public void testPercentileAlgorithm_Extremes() {
        PercentileSnapshot p = new PercentileSnapshot(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 800, 768, 657, 700, 867);

        System.out.println("0.01: " + p.getPercentile(0.01));
        System.out.println("10th: " + p.getPercentile(10));
        System.out.println("Median: " + p.getPercentile(50));
        System.out.println("75th: " + p.getPercentile(75));
        System.out.println("90th: " + p.getPercentile(90));
        System.out.println("99th: " + p.getPercentile(99));
        System.out.println("99.5th: " + p.getPercentile(99.5));
        System.out.println("99.99: " + p.getPercentile(99.99));
        Assert.assertEquals(2, p.getPercentile(50));
        Assert.assertEquals(2, p.getPercentile(10));
        Assert.assertEquals(2, p.getPercentile(75));
        if (p.getPercentile(95) < 600) {
            fail("We expect the 90th to be over 600 to show the extremes but got: " + p.getPercentile(90));
        }
        if (p.getPercentile(99) < 600) {
            fail("We expect the 99th to be over 600 to show the extremes but got: " + p.getPercentile(99));
        }
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        }
    }

    @Test
    public void testPercentileAlgorithm_HighPercentile() {
        PercentileSnapshot p = getPercentileForValues(1, 2, 3);
        Assert.assertEquals(2, p.getPercentile(50));
        Assert.assertEquals(3, p.getPercentile(75));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(3, p.getPercentile(75));
    }

    @Test
    public void testPercentileAlgorithm_LowPercentile() {
        PercentileSnapshot p = getPercentileForValues(1, 2);
        Assert.assertEquals(1, p.getPercentile(25));
        Assert.assertEquals(2, p.getPercentile(75));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(2, p.getPercentile(75));
    }

    @Test
    public void testPercentileAlgorithm_Percentiles() {
        PercentileSnapshot p = getPercentileForValues(10, 30, 20, 40);
        Assert.assertEquals(22, p.getPercentile(30), 1.0e-5);
        Assert.assertEquals(20, p.getPercentile(25), 1.0e-5);
        Assert.assertEquals(40, p.getPercentile(75), 1.0e-5);
        Assert.assertEquals(30, p.getPercentile(50), 1.0e-5);

        // invalid percentiles
        Assert.assertEquals(10, p.getPercentile(-1));
        Assert.assertEquals(40, p.getPercentile(101));
    }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixRollingPercentile.PercentileSnapshot

        Assert.assertEquals(40, p.getPercentile(101));
    }

    @Test
    public void testPercentileAlgorithm_NISTExample() {
        PercentileSnapshot p = getPercentileForValues(951772, 951567, 951937, 951959, 951442, 950610, 951591, 951195, 951772, 950925, 951990, 951682);
        Assert.assertEquals(951983, p.getPercentile(90));
        Assert.assertEquals(951990, p.getPercentile(100));
    }
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.