当前位置: 首页>>代码示例>>Java>>正文


Java MetricsHistogram类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram的典型用法代码示例。如果您正苦于以下问题:Java MetricsHistogram类的具体用法?Java MetricsHistogram怎么用?Java MetricsHistogram使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MetricsHistogram类属于org.apache.hadoop.hbase.metrics.histogram包,在下文中一共展示了MetricsHistogram类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendHistogram

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
private StringBuilder appendHistogram(StringBuilder sb, 
    MetricsHistogram histogram) {
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "Mean", 
      StringUtils.limitDecimalTo2(histogram.getMean()));
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "Count", 
      StringUtils.limitDecimalTo2(histogram.getCount()));
  final Snapshot s = histogram.getSnapshot();
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "Median", 
      StringUtils.limitDecimalTo2(s.getMedian()));
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "75th", 
      StringUtils.limitDecimalTo2(s.get75thPercentile()));
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "95th", 
      StringUtils.limitDecimalTo2(s.get95thPercentile()));
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "99th", 
      StringUtils.limitDecimalTo2(s.get99thPercentile()));
  sb = Strings.appendKeyValue(sb, 
      histogram.getName() + "999th", 
      StringUtils.limitDecimalTo2(s.get999thPercentile()));
  return sb;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:RegionServerMetrics.java

示例2: testPushMetric

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
@Test
public void testPushMetric() {
  final MetricsHistogram h = new MetricsHistogram("testHistogram", null);
  genRandomData(h);

  MetricsRecord mr = mock(MetricsRecord.class);
  h.pushMetric(mr);
  
  verify(mr).setMetric("testHistogram_num_ops", 10000L);
  verify(mr).setMetric(eq("testHistogram_min"), anyLong());
  verify(mr).setMetric(eq("testHistogram_max"), anyLong());
  verify(mr).setMetric(eq("testHistogram_mean"), anyFloat());
  verify(mr).setMetric(eq("testHistogram_std_dev"), anyFloat());
  verify(mr).setMetric(eq("testHistogram_median"), anyFloat());
  verify(mr).setMetric(eq("testHistogram_75th_percentile"), anyFloat());
  verify(mr).setMetric(eq("testHistogram_95th_percentile"), anyFloat());
  verify(mr).setMetric(eq("testHistogram_99th_percentile"), anyFloat());    
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:TestMetricsHistogram.java

示例3: copyMinusHBaseMetrics

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) {
  MetricsRegistry copy = new MetricsRegistry();
  for (MetricsBase metric : mr.getMetricsList()) {
    if (metric instanceof MetricsRate || metric instanceof MetricsString ||
        metric instanceof MetricsHistogram || metric instanceof ExactCounterMetric) {
      continue;
    }
    copy.add(metric.getName(), metric);
  }
  return copy;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:MetricsMBeanBase.java

示例4: testBasicUniform

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
@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());
  Assert.assertEquals(49.5d, h.getMean(), 0.01);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:TestMetricsHistogram.java

示例5: testSnapshotPercentiles

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
@Test
public void testSnapshotPercentiles() {
  final MetricsHistogram h = new MetricsHistogram("testHistogram", null);
  final long[] data = genRandomData(h);

  final Snapshot s = h.getSnapshot();

  assertPercentile(data, 50, s.getMedian());
  assertPercentile(data, 75, s.get75thPercentile());
  assertPercentile(data, 95, s.get95thPercentile());
  assertPercentile(data, 98, s.get98thPercentile());
  assertPercentile(data, 99, s.get99thPercentile());
  assertPercentile(data, 99.9, s.get999thPercentile());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:TestMetricsHistogram.java

示例6: genRandomData

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
private long[] genRandomData(final MetricsHistogram h) {
  final Random r = new Random();
  final long[] data = new long[10000];

  for (int i = 0; i < data.length; i++) {
    data[i] = (long) (r.nextGaussian() * 10000);
    h.update(data[i]);
  }
  
  return data;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:TestMetricsHistogram.java

示例7: testBasicUniform

import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram; //导入依赖的package包/类
@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());
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:13,代码来源:TestMetricsHistogram.java


注:本文中的org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。