本文整理了Java中org.HdrHistogram.Histogram.encodeIntoCompressedByteBuffer()
方法的一些代码示例,展示了Histogram.encodeIntoCompressedByteBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.encodeIntoCompressedByteBuffer()
方法的具体详情如下:
包路径:org.HdrHistogram.Histogram
类名称:Histogram
方法名:encodeIntoCompressedByteBuffer
暂无
代码示例来源:origin: HdrHistogram/HdrHistogram
@Override
public synchronized int encodeIntoCompressedByteBuffer(
final ByteBuffer targetBuffer,
final int compressionLevel) {
return super.encodeIntoCompressedByteBuffer(targetBuffer, compressionLevel);
}
代码示例来源:origin: HdrHistogram/HdrHistogram
@Override
public synchronized int encodeIntoCompressedByteBuffer(final ByteBuffer targetBuffer) {
return super.encodeIntoCompressedByteBuffer(targetBuffer);
}
代码示例来源:origin: linkedin/parseq
@Override
public synchronized String serialize(Histogram histogram) {
int requiredBytes = histogram.getNeededByteBufferCapacity() + (2 * Long.BYTES); // Long.BYTES for start and end timestamps
if ((targetBuffer == null) || targetBuffer.capacity() < requiredBytes) {
targetBuffer = ByteBuffer.allocate(requiredBytes);
}
targetBuffer.clear();
int compressedLength = histogram.encodeIntoCompressedByteBuffer(targetBuffer, Deflater.BEST_COMPRESSION);
targetBuffer.putLong(compressedLength, histogram.getStartTimeStamp());
targetBuffer.putLong(compressedLength + Long.BYTES, histogram.getEndTimeStamp());
byte[] compressedArray = Arrays.copyOf(targetBuffer.array(), compressedLength + (2 * Long.BYTES));
return DatatypeConverter.printBase64Binary(compressedArray);
}
代码示例来源:origin: org.hdrhistogram/HdrHistogram
@Override
public synchronized int encodeIntoCompressedByteBuffer(
final ByteBuffer targetBuffer,
final int compressionLevel) {
return super.encodeIntoCompressedByteBuffer(targetBuffer, compressionLevel);
}
代码示例来源:origin: org.hdrhistogram/HdrHistogram
@Override
public synchronized int encodeIntoCompressedByteBuffer(final ByteBuffer targetBuffer) {
return super.encodeIntoCompressedByteBuffer(targetBuffer);
}
代码示例来源:origin: openmessaging/openmessaging-benchmark
private void handleCumulativeLatencies(Context ctx) throws Exception {
CumulativeLatencies stats = localWorker.getCumulativeLatencies();
// Serialize histograms
synchronized (histogramSerializationBuffer) {
histogramSerializationBuffer.clear();
stats.publishLatency.encodeIntoCompressedByteBuffer(histogramSerializationBuffer);
stats.publishLatencyBytes = new byte[histogramSerializationBuffer.position()];
histogramSerializationBuffer.flip();
histogramSerializationBuffer.get(stats.publishLatencyBytes);
histogramSerializationBuffer.clear();
stats.endToEndLatency.encodeIntoCompressedByteBuffer(histogramSerializationBuffer);
stats.endToEndLatencyBytes = new byte[histogramSerializationBuffer.position()];
histogramSerializationBuffer.flip();
histogramSerializationBuffer.get(stats.endToEndLatencyBytes);
}
ctx.result(writer.writeValueAsString(stats));
}
代码示例来源:origin: openmessaging/openmessaging-benchmark
private void handlePeriodStats(Context ctx) throws Exception {
PeriodStats stats = localWorker.getPeriodStats();
// Serialize histograms
synchronized (histogramSerializationBuffer) {
histogramSerializationBuffer.clear();
stats.publishLatency.encodeIntoCompressedByteBuffer(histogramSerializationBuffer);
stats.publishLatencyBytes = new byte[histogramSerializationBuffer.position()];
histogramSerializationBuffer.flip();
histogramSerializationBuffer.get(stats.publishLatencyBytes);
histogramSerializationBuffer.clear();
stats.endToEndLatency.encodeIntoCompressedByteBuffer(histogramSerializationBuffer);
stats.endToEndLatencyBytes = new byte[histogramSerializationBuffer.position()];
histogramSerializationBuffer.flip();
histogramSerializationBuffer.get(stats.endToEndLatencyBytes);
}
ctx.result(writer.writeValueAsString(stats));
}
代码示例来源:origin: org.attribyte/essem-reporter
org.HdrHistogram.Histogram storedHistogram = hdrSnapshot.sinceLastSnapshot().getHistogram();
ByteBuffer buf = ByteBuffer.allocate(storedHistogram.getNeededByteBufferCapacity());
int compressedSize = storedHistogram.encodeIntoCompressedByteBuffer(buf);
buf.rewind();
histogramBuilder.setHdrHistogram(ByteString.copyFrom(buf, compressedSize));
org.HdrHistogram.Histogram storedHistogram = hdrSnapshot.sinceLastSnapshot().getHistogram();
ByteBuffer buf = ByteBuffer.allocate(storedHistogram.getNeededByteBufferCapacity());
int compressedSize = storedHistogram.encodeIntoCompressedByteBuffer(buf);
buf.rewind();
timerBuilder.setHdrHistogram(ByteString.copyFrom(buf, compressedSize));
内容来源于网络,如有侵权,请联系作者删除!