private static void printStatistic( GraalTruffleRuntime rt, String label, IntSummaryStatistics value) { rt.log( String.format( " %-50s: count=%4d, sum=%8d, min=%8d, average=%12.2f, max=%8d ", label, value.getCount(), value.getSum(), value.getMin(), value.getAverage(), value.getMax())); }
/** {@inheritDoc} */ @Override public RequestAggregationValues aggregate(RequestCollector requests) { IntSummaryStatistics stats = requests .getReqTimestamps() .stream() .collect( Collectors.groupingBy( timestamp -> DateUtils.round(new Date(timestamp), timestampAggregation), Collectors.counting())) .values() .stream() .mapToInt(p -> toInt(p)) .summaryStatistics(); return new RequestAggregationValuesImpl( stats.getMin(), stats.getMax(), stats.getAverage(), stats.getSum(), stats.getCount()); }