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

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

Introduction

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

Prototype

public synchronized void increment() 

Source Link

Document

Add a new event to the series.

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   www . j  a v a 2s.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//from w w w . java  2s  .c o  m
public void testPerf() {
    ExponentialMovingAverageRate rate = new ExponentialMovingAverageRate(1, 60, 10);
    for (int i = 0; i < 1000000; i++) {
        rate.increment();
    }
}