Example usage for java.util LongSummaryStatistics getMax

List of usage examples for java.util LongSummaryStatistics getMax

Introduction

In this page you can find the example usage for java.util LongSummaryStatistics getMax.

Prototype

public final long getMax() 

Source Link

Document

Returns the maximum value recorded, or Long.MIN_VALUE if no values have been recorded

Usage

From source file:de.tynne.benchmarksuite.Main.java

private static void checkNano(PrintStream ps) {
    List<Long> diffs = new ArrayList<>();

    nanoNullLoop(1000000, diffs);/*from  w ww.j a  v  a  2 s . c o  m*/
    diffs.clear();
    nanoNullLoop(1000000, diffs);

    LongSummaryStatistics statistics = diffs.stream().mapToLong(l -> l).summaryStatistics();

    ps.printf("min=%d, avg=%g, max=%d\n", statistics.getMin(), statistics.getAverage(), statistics.getMax());
}

From source file:org.apache.metron.profiler.storm.ProfileBuilderBolt.java

/**
 * Logs information about the {@link TupleWindow}.
 *
 * @param window The tuple window./*from w  w  w .  j  a v a  2s  .  c om*/
 */
private void log(TupleWindow window) {
    // summarize the newly received tuples
    LongSummaryStatistics received = window.get().stream()
            .map(tuple -> getField(TIMESTAMP_TUPLE_FIELD, tuple, Long.class))
            .collect(Collectors.summarizingLong(Long::longValue));

    LOG.debug("Tuple(s) received; count={}, min={}, max={}, range={} ms", received.getCount(),
            received.getMin(), received.getMax(), received.getMax() - received.getMin());

    if (window.getExpired().size() > 0) {
        // summarize the expired tuples
        LongSummaryStatistics expired = window.getExpired().stream()
                .map(tuple -> getField(TIMESTAMP_TUPLE_FIELD, tuple, Long.class))
                .collect(Collectors.summarizingLong(Long::longValue));

        LOG.debug("Tuple(s) expired; count={}, min={}, max={}, range={} ms, lag={} ms", expired.getCount(),
                expired.getMin(), expired.getMax(), expired.getMax() - expired.getMin(),
                received.getMin() - expired.getMin());
    }
}

From source file:org.apache.nifi.cluster.coordination.http.replication.ThreadPoolRequestReplicator.java

private void logTimingInfo(final AsyncClusterResponse response) {
    // Calculate min, max, mean for the requests
    final LongSummaryStatistics stats = response.getNodesInvolved().stream()
            .map(p -> response.getNodeResponse(p).getRequestDuration(TimeUnit.MILLISECONDS))
            .collect(Collectors.summarizingLong(Long::longValue));

    final StringBuilder sb = new StringBuilder();
    sb.append("Node Responses for ").append(response.getMethod()).append(" ").append(response.getURIPath())
            .append(" (Request ID ").append(response.getRequestIdentifier()).append("):\n");
    for (final NodeIdentifier node : response.getNodesInvolved()) {
        sb.append(node).append(": ")
                .append(response.getNodeResponse(node).getRequestDuration(TimeUnit.MILLISECONDS))
                .append(" millis\n");
    }/*from   w ww . j  ava2  s .c o m*/

    logger.debug("For {} {} (Request ID {}), minimum response time = {}, max = {}, average = {} ms",
            response.getMethod(), response.getURIPath(), response.getRequestIdentifier(), stats.getMin(),
            stats.getMax(), stats.getAverage());
    logger.debug(sb.toString());
}