MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / histogram

Method histogram

src/core/SimpleHistogram.java:72–95  ·  view source on GitHub ↗
(final boolean include_id)

Source from the content-addressed store, hash-verified

70 }
71
72 public byte[] histogram(final boolean include_id) {
73 ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
74 Output output = new Output(outBuffer);
75
76 int bucketCount = buckets.size();
77 try {
78 if (include_id) {
79 output.writeByte(id);
80 }
81 output.writeShort(bucketCount);
82
83 for (Map.Entry<HistogramBucket, Long> bucket : buckets.entrySet()) {
84 output.writeFloat(bucket.getKey().getLowerBound());
85 output.writeFloat(bucket.getKey().getUpperBound());
86 output.writeLong(bucket.getValue(), true);
87 }
88
89 output.writeLong(this.getUnderflow(), true);
90 output.writeLong(this.getOverflow(), true);
91 } finally {
92 output.close();
93 }
94 return outBuffer.toByteArray();
95 }
96
97 public void fromHistogram(byte[] raw, final boolean include_id) {
98 if (raw.length < 6) {

Callers 3

verifyE2EKryoMethod · 0.95
testToFromBytesMethod · 0.95

Calls 9

getUnderflowMethod · 0.95
getOverflowMethod · 0.95
getLowerBoundMethod · 0.80
getUpperBoundMethod · 0.80
toByteArrayMethod · 0.80
sizeMethod · 0.65
getKeyMethod · 0.45
getValueMethod · 0.45
closeMethod · 0.45

Tested by 3

verifyE2EKryoMethod · 0.76
testToFromBytesMethod · 0.76