Example usage for org.springframework.integration.support.management ExponentialMovingAverageRate ExponentialMovingAverageRate

List of usage examples for org.springframework.integration.support.management ExponentialMovingAverageRate ExponentialMovingAverageRate

Introduction

In this page you can find the example usage for org.springframework.integration.support.management ExponentialMovingAverageRate ExponentialMovingAverageRate.

Prototype

public ExponentialMovingAverageRate(double period, double lapsePeriod, int window) 

Source Link

Usage

From source file:org.springframework.integration.support.management.ExponentialMovingAverageRateTests.java

@Test
@Ignore // tolerance needed is too dependent on hardware
public void testRate() {
    ExponentialMovingAverageRate rate = new ExponentialMovingAverageRate(1, 60, 10);
    int count = 1000000;
    StopWatch watch = new StopWatch();
    watch.start();/*from   w  w  w  .  j a v a2s. com*/
    for (int i = 0; i < count; i++) {
        rate.increment();
    }
    watch.stop();
    double calculatedRate = count / (double) watch.getTotalTimeMillis() * 1000;
    assertEquals(calculatedRate, rate.getMean(), 4000000);
}

From source file:org.springframework.integration.support.management.ExponentialMovingAverageRateTests.java

@Test
@Ignore/*  ww w . j  a v a2  s. c  om*/
public void testPerf() {
    ExponentialMovingAverageRate rate = new ExponentialMovingAverageRate(1, 60, 10);
    for (int i = 0; i < 1000000; i++) {
        rate.increment();
    }
}