These are chat archives for HdrHistogram/HdrHistogram
How do you store a hdr histogram in a db or send it across a wire?
It seems to have that functionality but it doesn't seem to work. it seems to have the ability to export it into a byte buffer and vice versa.
ByteBuffer byteBuffer1 = ByteBuffer.allocate(histogram.getNeededByteBufferCapacity()); histogram.encodeIntoByteBuffer(byteBuffer1); byte newValue = new byte[byteBuffer1.remaining()]; byteBuffer1.get(newValue); ByteBuffer byteBuffer2 = ByteBuffer.wrap(newValue); histogram = Histogram.decodeFromByteBuffer(byteBuffer2, 3600000000000L);
But the last line blows up, it doesn't seem to recognize bytes that were exported out of its own.
Caused by: java.lang.IllegalArgumentException: The buffer does not contain a Histogram (no valid cookie found) at org.HdrHistogram.AbstractHistogram.decodeFromByteBuffer(AbstractHistogram.java:1835) at org.HdrHistogram.AbstractHistogram.decodeFromByteBuffer(AbstractHistogram.java:1792) at org.HdrHistogram.Histogram.decodeFromByteBuffer(Histogram.java:241)
I still get the error if I skip the byte array,
ByteBuffer byteBuffer1 = ByteBuffer.allocate(histogram.getNeededByteBufferCapacity()); histogram.encodeIntoByteBuffer(byteBuffer1); histogram = Histogram.decodeFromByteBuffer(byteBuffer1, 3600000000000L);