presto-benchmark/src/main/java/io/prestosql/benchmark/JsonAvgBenchmarkResultWriter.java/JsonAvgBenchmarkResultWriter/finished
class JsonAvgBenchmarkResultWriter:    @Override
    public void finished()
    {
        BuildResult average = new BuildResult();
        average.elapsedMillis += totalElapsedMillis / sampleCount;
        average.inputRows += totalInputRows / sampleCount;
        average.inputRowsPerSecond += totalInputRowsPerSecond / sampleCount;
        average.outputRows += totalOutputRows / sampleCount;
        average.outputRowsPerSecond += totalOutputRowsPerSecond / sampleCount;
        average.inputMegabytes += totalInputRows / sampleCount;
        average.inputMegabytesPerSecond += totalInputMegabytesPerSecond / sampleCount;

        String json = JSON_CODEC.toJson(average);
        try {
            outputStream.write(json.getBytes(UTF_8));
        }
        catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }