本文整理汇总了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;未经允许,请勿转载。 |
请发表评论