本文整理了Java中org.HdrHistogram.Histogram.decodeFromCompressedByteBuffer()
方法的一些代码示例,展示了Histogram.decodeFromCompressedByteBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.decodeFromCompressedByteBuffer()
方法的具体详情如下:
包路径:org.HdrHistogram.Histogram
类名称:Histogram
方法名:decodeFromCompressedByteBuffer
暂无
代码示例来源:origin: HdrHistogram/HdrHistogram
/**
* Construct a new histogram by decoding it from a compressed form in a ByteBuffer.
* @param buffer The buffer to decode from
* @param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high
* @return The newly constructed histogram
* @throws DataFormatException on error parsing/decompressing the buffer
*/
public static Histogram decodeFromCompressedByteBuffer(final ByteBuffer buffer,
final long minBarForHighestTrackableValue) throws DataFormatException {
return decodeFromCompressedByteBuffer(buffer, Histogram.class, minBarForHighestTrackableValue);
}
代码示例来源:origin: HdrHistogram/HdrHistogram
/**
* Decode a {@EncodableHistogram} from a compressed byte buffer. Will return either a
* {@link org.HdrHistogram.Histogram} or {@link org.HdrHistogram.DoubleHistogram} depending
* on the format found in the supplied buffer.
*
* @param buffer The input buffer to decode from.
* @param minBarForHighestTrackableValue A lower bound either on the highestTrackableValue of
* the created Histogram, or on the HighestToLowestValueRatio
* of the created DoubleHistogram.
* @return The decoded {@link org.HdrHistogram.Histogram} or {@link org.HdrHistogram.DoubleHistogram}
* @throws DataFormatException on errors in decoding the buffer compression.
*/
static EncodableHistogram decodeFromCompressedByteBuffer(
ByteBuffer buffer,
final long minBarForHighestTrackableValue) throws DataFormatException {
// Peek iun buffer to see the cookie:
int cookie = buffer.getInt(buffer.position());
if (DoubleHistogram.isDoubleHistogramCookie(cookie)) {
return DoubleHistogram.decodeFromCompressedByteBuffer(buffer, minBarForHighestTrackableValue);
} else {
return Histogram.decodeFromCompressedByteBuffer(buffer, minBarForHighestTrackableValue);
}
}
}
代码示例来源:origin: org.hdrhistogram/HdrHistogram
/**
* Construct a new histogram by decoding it from a compressed form in a ByteBuffer.
* @param buffer The buffer to decode from
* @param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high
* @return The newly constructed histogram
* @throws DataFormatException on error parsing/decompressing the buffer
*/
public static Histogram decodeFromCompressedByteBuffer(final ByteBuffer buffer,
final long minBarForHighestTrackableValue) throws DataFormatException {
return decodeFromCompressedByteBuffer(buffer, Histogram.class, minBarForHighestTrackableValue);
}
代码示例来源:origin: openmessaging/openmessaging-benchmark
@Override
public PeriodStats getPeriodStats() {
List<PeriodStats> individualStats = get(workers, "/period-stats", PeriodStats.class);
PeriodStats stats = new PeriodStats();
individualStats.forEach(is -> {
stats.messagesSent += is.messagesSent;
stats.bytesSent += is.bytesSent;
stats.messagesReceived += is.messagesReceived;
stats.bytesReceived += is.bytesReceived;
stats.totalMessagesSent += is.totalMessagesSent;
stats.totalMessagesReceived += is.totalMessagesReceived;
try {
stats.publishLatency.add(Histogram.decodeFromCompressedByteBuffer(
ByteBuffer.wrap(is.publishLatencyBytes), TimeUnit.SECONDS.toMicros(30)));
stats.endToEndLatency.add(Histogram.decodeFromCompressedByteBuffer(
ByteBuffer.wrap(is.endToEndLatencyBytes), TimeUnit.HOURS.toMicros(12)));
} catch (ArrayIndexOutOfBoundsException | DataFormatException e) {
throw new RuntimeException(e);
}
});
return stats;
}
代码示例来源:origin: org.hdrhistogram/HdrHistogram
/**
* Decode a {@EncodableHistogram} from a compressed byte buffer. Will return either a
* {@link org.HdrHistogram.Histogram} or {@link org.HdrHistogram.DoubleHistogram} depending
* on the format found in the supplied buffer.
*
* @param buffer The input buffer to decode from.
* @param minBarForHighestTrackableValue A lower bound either on the highestTrackableValue of
* the created Histogram, or on the HighestToLowestValueRatio
* of the created DoubleHistogram.
* @return The decoded {@link org.HdrHistogram.Histogram} or {@link org.HdrHistogram.DoubleHistogram}
* @throws DataFormatException on errors in decoding the buffer compression.
*/
static EncodableHistogram decodeFromCompressedByteBuffer(
ByteBuffer buffer,
final long minBarForHighestTrackableValue) throws DataFormatException {
// Peek iun buffer to see the cookie:
int cookie = buffer.getInt(buffer.position());
if (DoubleHistogram.isDoubleHistogramCookie(cookie)) {
return DoubleHistogram.decodeFromCompressedByteBuffer(buffer, minBarForHighestTrackableValue);
} else {
return Histogram.decodeFromCompressedByteBuffer(buffer, minBarForHighestTrackableValue);
}
}
}
代码示例来源:origin: openmessaging/openmessaging-benchmark
@Override
public CumulativeLatencies getCumulativeLatencies() {
List<CumulativeLatencies> individualStats = get(workers, "/cumulative-latencies", CumulativeLatencies.class);
CumulativeLatencies stats = new CumulativeLatencies();
individualStats.forEach(is -> {
try {
stats.publishLatency.add(Histogram.decodeFromCompressedByteBuffer(
ByteBuffer.wrap(is.publishLatencyBytes), TimeUnit.SECONDS.toMicros(30)));
} catch (Exception e) {
log.error("Failed to decode publish latency: {}",
ByteBufUtil.prettyHexDump(Unpooled.wrappedBuffer(is.publishLatencyBytes)));
throw new RuntimeException(e);
}
try {
stats.endToEndLatency.add(Histogram.decodeFromCompressedByteBuffer(
ByteBuffer.wrap(is.endToEndLatencyBytes), TimeUnit.HOURS.toMicros(12)));
} catch (Exception e) {
log.error("Failed to decode end-to-end latency: {}",
ByteBufUtil.prettyHexDump(Unpooled.wrappedBuffer(is.endToEndLatencyBytes)));
throw new RuntimeException(e);
}
});
return stats;
}
内容来源于网络,如有侵权,请联系作者删除!