Package org.apache.hadoop.hbase.metrics.histogram

Examples of org.apache.hadoop.hbase.metrics.histogram.ExponentiallyDecayingSample


public class TestExponentiallyDecayingSample {
 
  @Test
  public void testBasic() {
      final ExponentiallyDecayingSample sample =
          new ExponentiallyDecayingSample(100, 0.99);
     
      for (int i = 0; i < 1000; i++) {
          sample.update(i);
      }
      Assert.assertEquals(100, sample.size());
     
      final Snapshot snapshot = sample.getSnapshot();
      Assert.assertEquals(100, snapshot.size());

      for (double i : snapshot.getValues()) {
        Assert.assertTrue(i >= 0.0 && i < 1000.0);
      }
View Full Code Here


      }
  }

  @Test
  public void testTooBig() throws Exception {
      final ExponentiallyDecayingSample sample =
          new ExponentiallyDecayingSample(100, 0.99);
      for (int i = 0; i < 10; i++) {
          sample.update(i);
      }
      Assert.assertEquals(10, sample.size());

      final Snapshot snapshot = sample.getSnapshot();
      Assert.assertEquals(10, sample.size());

      for (double i : snapshot.getValues()) {
        Assert.assertTrue(i >= 0.0 && i < 1000.0);
      }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.metrics.histogram.ExponentiallyDecayingSample

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.