• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HistogramIterationValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getValues

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
@Override
public long[] getValues() {
    long[] vals = new long[(int) histogram.getTotalCount()];
    int i = 0;

    for (HistogramIterationValue value : histogram.recordedValues()) {
        long val = value.getValueIteratedTo();

        for (int j = 0; j < value.getCountAddedInThisIterationStep(); j++) {
            vals[i] = val;

            i++;
        }
    }

    if (i != vals.length) {
        throw new IllegalStateException(
            "Total count was " + histogram.getTotalCount() + " but iterating values produced " + vals.length);
    }

    return vals;
}
 
开发者ID:networknt,项目名称:light-4j,代码行数:23,代码来源:HistogramSnapshot.java


示例2: testDone_withExternalStarted

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
@Test
public void testDone_withExternalStarted() throws InterruptedException {
    long expectedLatency = TimeUnit.SECONDS.toNanos(2);

    long started = System.nanoTime();

    TimeUnit.NANOSECONDS.sleep(expectedLatency);

    probe.done(started);

    Histogram histogram = probe.getRecorder().getIntervalHistogram();
    assertEquals(1, histogram.getTotalCount());

    HistogramIterationValue iterationValue = histogram.recordedValues().iterator().next();
    assertTrue(0.90 * iterationValue.getValueIteratedFrom() < expectedLatency);
    assertTrue(1.10 * iterationValue.getValueIteratedTo() > expectedLatency);
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:18,代码来源:HdrProbeTest.java


示例3: contains

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
private boolean contains(Histogram histogram, long value) {
    for (HistogramIterationValue iterationValue : histogram.allValues()) {
        if (iterationValue.getTotalCountToThisValue() == 0) {
            continue;
        }

        long max = iterationValue.getValueIteratedTo();
        long min = iterationValue.getValueIteratedFrom();

        if (value >= min && value <= max) {
            return true;
        }

    }
    return false;
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:17,代码来源:HdrProbeTest.java


示例4: dump

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
@Override
public void dump(OutputStream output) {
    PrintWriter p = null;
    try {
        p = new PrintWriter(new OutputStreamWriter(output, UTF_8));
        for (HistogramIterationValue value : histogram.recordedValues()) {
            for (int j = 0; j < value.getCountAddedInThisIterationStep(); j++) {
                p.printf("%d%n", value.getValueIteratedTo());
            }
        }
    } catch (Exception e) {
        if(p != null) p.close();
        logger.error("Exception:", e);
    }
}
 
开发者ID:networknt,项目名称:light-4j,代码行数:16,代码来源:HistogramSnapshot.java


示例5: getValues

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
@Override
public long[] getValues() {
    long[] values = new long[(int) histogram.getTotalCount()];
    int i = 0;

    for (HistogramIterationValue value : histogram.recordedValues()) {
        long v = value.getValueIteratedTo();
        for (int j = 0; j < value.getCountAddedInThisIterationStep(); j++) {
            values[i] = v;
            i++;
        }
    }

    return values;
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:16,代码来源:HdrHistogramSnapshot.java


示例6: dump

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
@Override
public void dump(OutputStream output) {
    try (PrintWriter out = new PrintWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8))) {
        for (HistogramIterationValue value : histogram.recordedValues()) {
            long v = value.getValueIteratedTo();
            for (int j = 0; j < value.getCountAddedInThisIterationStep(); j++) {
                out.printf("%d%n", v);
            }
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:12,代码来源:HdrHistogramSnapshot.java


示例7: testFullSnapshotCalculation

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
@Test
public void testFullSnapshotCalculation() {
    Reservoir reservoir = new HdrBuilder().withoutSnapshotOptimization().buildReservoir();
    Snapshot snapshot = snapshotTaker.apply(reservoir);

    Histogram hdrHistogram = createEquivalentHistogram();
    assertEquals(hdrHistogram.getStdDeviation(), snapshot.getStdDev());
    assertEquals(hdrHistogram.getMinValue(), snapshot.getMin());
    assertEquals(hdrHistogram.getMean(), snapshot.getMean());
    assertEquals(hdrHistogram.getValueAtPercentile(50.0), (long) snapshot.getMedian());
    assertEquals(hdrHistogram.getMaxValue(), snapshot.getMax());
    assertEquals(hdrHistogram.getValueAtPercentile(60.0), (long) snapshot.getValue(0.6));
    assertEquals(hdrHistogram.getValueAtPercentile(75.0), (long) snapshot.get75thPercentile());
    assertEquals(hdrHistogram.getValueAtPercentile(80.0), (long) snapshot.getValue(0.8));
    assertEquals(hdrHistogram.getValueAtPercentile(90.0), (long) snapshot.getValue(0.9));
    assertEquals(hdrHistogram.getValueAtPercentile(94.0), (long) snapshot.getValue(0.94));
    assertEquals(hdrHistogram.getValueAtPercentile(95.0), (long) snapshot.get95thPercentile());
    assertEquals(hdrHistogram.getValueAtPercentile(98.0), (long) snapshot.get98thPercentile());
    assertEquals(hdrHistogram.getValueAtPercentile(99.0), (long) snapshot.get99thPercentile());
    assertEquals(hdrHistogram.getValueAtPercentile(99.9), (long) snapshot.get999thPercentile());

    assertEquals(hdrHistogram.getTotalCount(), snapshot.size());

    int i = 0;
    long[] values = snapshot.getValues();
    for (HistogramIterationValue value : hdrHistogram.recordedValues()) {
        assertEquals(value.getValueIteratedTo(), values[i++]);
    }
}
 
开发者ID:vladimir-bukhtoyarov,项目名称:rolling-metrics,代码行数:30,代码来源:PercentileCalculationTest.java


示例8: merge

import org.HdrHistogram.HistogramIterationValue; //导入依赖的package包/类
private static Histogram merge(List<Histogram> histograms) {
  Histogram merged = new Histogram(HISTOGRAM_MAX_VALUE, HISTOGRAM_PRECISION);
  for (Histogram histogram : histograms) {
    for (HistogramIterationValue value : histogram.allValues()) {
      long latency = value.getValueIteratedTo();
      long count = value.getCountAtValueIteratedTo();
      merged.recordValueWithCount(latency, count);
    }
  }
  return merged;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:12,代码来源:AsyncClient.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StackRecorder类代码示例发布时间:2022-05-23
下一篇:
Java Ethernet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap