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

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

Introduction

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

Prototype

public double getMean() 

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();//  w  ww .  j  av a2 s.  co  m
    for (int i = 0; i < count; i++) {
        rate.increment();
    }
    watch.stop();
    double calculatedRate = count / (double) watch.getTotalTimeMillis() * 1000;
    assertEquals(calculatedRate, rate.getMean(), 4000000);
}