use of com.navercorp.pinpoint.common.trace.UriStatHistogramBucket in project pinpoint by naver.
the class UriStatHistogramTest method assertScheme.
void assertScheme(Random random, UriStatHistogramBucket prev, UriStatHistogramBucket current, int expectedIndex) {
long value = Math.abs(random.nextLong());
value %= (current.getTo() - current.getFrom());
if (prev != null) {
value += prev.getTo();
}
UriStatHistogramBucket result = UriStatHistogramBucket.getValue(value);
Assert.assertEquals(current, result);
Assert.assertEquals(expectedIndex, result.getIndex());
}
use of com.navercorp.pinpoint.common.trace.UriStatHistogramBucket in project pinpoint by naver.
the class GrpcUriStatMessageConverterTest method assertData.
private void assertData(List<UriStatInfo> expected, PUriHistogram actual) {
Assert.assertEquals(expected.size(), actual.getCount());
Assert.assertEquals(getMax(expected), actual.getMax());
Assert.assertEquals(new Double(getAvg(expected)).longValue(), new Double(actual.getAvg()).longValue());
List<Integer> histogramList = actual.getHistogramList();
for (int i = 0; i < histogramList.size(); i++) {
UriStatHistogramBucket valueByIndex = UriStatHistogramBucket.getValueByIndex(i);
int bucketCount = getBucketCount(expected, valueByIndex);
Assert.assertEquals(new Integer(bucketCount), histogramList.get(i));
}
}
use of com.navercorp.pinpoint.common.trace.UriStatHistogramBucket in project pinpoint by naver.
the class AgentUriStatSampler method createHistogramBucketCountMap.
private Map<UriStatHistogramBucket, Integer> createHistogramBucketCountMap(List<UriStatHistogram> uriStatHistogramList) {
int[] mergedHistogramValue = new int[UriStatHistogramBucket.getBucketSize()];
for (UriStatHistogram uriStatHistogram : uriStatHistogramList) {
int[] timestampHistogram = uriStatHistogram.getTimestampHistogram();
for (int i = 0; i < mergedHistogramValue.length; i++) {
mergedHistogramValue[i] += timestampHistogram[i];
}
}
Map<UriStatHistogramBucket, Integer> uriStatHistogramBucketCountMap = new EnumMap<>(UriStatHistogramBucket.class);
for (UriStatHistogramBucket value : BUCKETS) {
int eachBucketTotalCount = mergedHistogramValue[value.getIndex()];
uriStatHistogramBucketCountMap.put(value, eachBucketTotalCount);
}
return uriStatHistogramBucketCountMap;
}
Aggregations