Examples of MetricsHistogram


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

  }
 
  @Test
  public void testRandom() {
    final Random r = new Random();
    final MetricsHistogram h = new MetricsHistogram("testHistogram", null);

    final long[] data = new long[1000];

    for (int i = 0; i < data.length; i++) {
      data[i] = (long) (r.nextGaussian() * 10000.0);
      h.update(data[i]);
    }

    final Snapshot s = h.getSnapshot();
    Arrays.sort(data);

    // as long as the histogram chooses an item with index N+/-slop, accept it
    final int slop = 20;

View Full Code Here

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

public class TestMetricsHistogram {

  @Test
  public void testBasicUniform() {
    MetricsHistogram h = new MetricsHistogram("testHistogram", null);

    for (int i = 0; i < 100; i++) {
      h.update(i);
    }

    Assert.assertEquals(100, h.getCount());
    Assert.assertEquals(0, h.getMin());
    Assert.assertEquals(99, h.getMax());
  }
View Full Code Here

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

  }
 
  @Test
  public void testRandom() {
    final Random r = new Random();
    final MetricsHistogram h = new MetricsHistogram("testHistogram", null);

    final long[] data = new long[1000];

    for (int i = 0; i < data.length; i++) {
      data[i] = (long) (r.nextGaussian() * 10000.0);
      h.update(data[i]);
    }

    final Snapshot s = h.getSnapshot();
    Arrays.sort(data);

    // as long as the histogram chooses an item with index N+/-slop, accept it
    final int slop = 20;

View Full Code Here

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

        if (metric instanceof MetricsRate) {
          return ((MetricsRate) metric).getPreviousIntervalValue();
        } else if (metric instanceof MetricsString) {
          return ((MetricsString)metric).getValue();
        } else if (metric instanceof MetricsHistogram)  {
          MetricsHistogram hist = (MetricsHistogram) metric;
          if (name.endsWith(MetricsHistogram.NUM_OPS_METRIC_NAME)) {
            return hist.getCount();
          } else if (name.endsWith(MetricsHistogram.MIN_METRIC_NAME)) {
            return hist.getMin();
          } else if (name.endsWith(MetricsHistogram.MAX_METRIC_NAME)) {
            return hist.getMax();
          } else if (name.endsWith(MetricsHistogram.MEAN_METRIC_NAME)) {
            return (float) hist.getMean();
          } else if (name.endsWith(MetricsHistogram.STD_DEV_METRIC_NAME)) {
            return (float) hist.getStdDev();
          } else if (name.endsWith(MetricsHistogram.MEDIAN_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.getMedian();
          } else if (name.endsWith(MetricsHistogram.SEVENTY_FIFTH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get75thPercentile();
          } else if (name.endsWith(MetricsHistogram.NINETY_FIFTH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get95thPercentile();
          } else if (name.endsWith(MetricsHistogram.NINETY_NINETH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get99thPercentile();
          }

        } else {
          LOG.warn( String.format("unknown metrics type %s for attribute %s",
View Full Code Here

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

  }

  public void testMetricsMBeanBaseHistogram()
      throws ReflectionException, AttributeNotFoundException, MBeanException {
    MetricsRegistry mr = new MetricsRegistry();
    MetricsHistogram histo = mock(MetricsHistogram.class);
    Snapshot snap = mock(Snapshot.class);

    //Set up the mocks
    String histoName = "MockHisto";
    when(histo.getName()).thenReturn(histoName);
    when(histo.getCount()).thenReturn(20l);
    when(histo.getMin()).thenReturn(1l);
    when(histo.getMax()).thenReturn(999l);
    when(histo.getMean()).thenReturn(500.2);
    when(histo.getStdDev()).thenReturn(1.2);
    when(histo.getSnapshot()).thenReturn(snap);

    when(snap.getMedian()).thenReturn(490.0);
    when(snap.get75thPercentile()).thenReturn(550.0);
    when(snap.get95thPercentile()).thenReturn(900.0);
    when(snap.get99thPercentile()).thenReturn(990.0);
View Full Code Here

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

public class TestMetricsHistogram {

  @Test
  public void testBasicUniform() {
    MetricsHistogram h = new MetricsHistogram("testHistogram", null);

    for (int i = 0; i < 100; i++) {
      h.update(i);
    }

    Assert.assertEquals(100, h.getCount());
    Assert.assertEquals(0, h.getMin());
    Assert.assertEquals(99, h.getMax());
  }
View Full Code Here

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

  }
 
  @Test
  public void testRandom() {
    final Random r = new Random();
    final MetricsHistogram h = new MetricsHistogram("testHistogram", null);

    final long[] data = new long[1000];

    for (int i = 0; i < data.length; i++) {
      data[i] = (long) (r.nextGaussian() * 10000.0);
      h.update(data[i]);
    }

    final Snapshot s = h.getSnapshot();
    Arrays.sort(data);

    // as long as the histogram chooses an item with index N+/-slop, accept it
    final int slop = 20;

View Full Code Here

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

  }

  public void testMetricsMBeanBaseHistogram()
      throws ReflectionException, AttributeNotFoundException, MBeanException {
    MetricsRegistry mr = new MetricsRegistry();
    MetricsHistogram histo = mock(MetricsHistogram.class);
    Snapshot snap = mock(Snapshot.class);

    //Set up the mocks
    String histoName = "MockHisto";
    when(histo.getName()).thenReturn(histoName);
    when(histo.getCount()).thenReturn(20l);
    when(histo.getMin()).thenReturn(1l);
    when(histo.getMax()).thenReturn(999l);
    when(histo.getMean()).thenReturn(500.2);
    when(histo.getStdDev()).thenReturn(1.2);
    when(histo.getSnapshot()).thenReturn(snap);

    when(snap.getMedian()).thenReturn(490.0);
    when(snap.get75thPercentile()).thenReturn(550.0);
    when(snap.get95thPercentile()).thenReturn(900.0);
    when(snap.get99thPercentile()).thenReturn(990.0);
View Full Code Here

Examples of org.qi4j.api.metrics.MetricsHistogram

    @Test
    public void givenMetricsProviderWithoutSupportForHistogramWhenRequestingHistogramExpectDefaultNullImplementation()
    {
        MetricsProvider underTest = new MetricsProviderAdapter();
        MetricsHistogramFactory factory = underTest.createFactory( MetricsHistogramFactory.class );
        MetricsHistogram test = factory.createHistogram( getClass(), "test" );
        test.update( 5L );
        test.update( 5L );
        test.update( 5L );
    }
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.