ARTEMIS-1476 Improving output on percentiles
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e34b787a Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e34b787a Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e34b787a Branch: refs/heads/master Commit: e34b787a77fff072d8ad30154d90f6fcfff219ec Parents: c76369a Author: Clebert Suconic <clebertsuco...@apache.org> Authored: Thu Oct 26 11:29:46 2017 -0400 Committer: Clebert Suconic <clebertsuco...@apache.org> Committed: Thu Oct 26 12:20:17 2017 -0400 ---------------------------------------------------------------------- .../cli/commands/util/SyncCalculation.java | 44 ++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e34b787a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/util/SyncCalculation.java ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/util/SyncCalculation.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/util/SyncCalculation.java index fa99c7b..c01506d 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/util/SyncCalculation.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/util/SyncCalculation.java @@ -82,8 +82,21 @@ public class SyncCalculation { //the write latencies could be taken only when writes are effectively synchronous final Histogram writeLatencies = (verbose && !asyncWrites) ? new Histogram(MAX_FLUSH_NANOS, 2) : null; + if (journalType == JournalType.ASYNCIO && syncWrites) { + System.out.println(); + System.out.println("*******************************************************************************************"); + System.out.println("*** Notice: The recommendation for AsyncIO journal is to not use --sync-writes ***"); + System.out.println("*** The measures here will be useful to understand your device ***"); + System.out.println("*** however the result here won't represent the best configuration option ***"); + System.out.println("*******************************************************************************************"); + System.out.println(); + } + if (verbose) { System.out.println("Using " + factory.getClass().getName() + " to calculate sync times, alignment=" + factory.getAlignment()); + if (writeLatencies == null) { + System.out.println("*** Use --sync-writes if you want to see a histogram for each write performed ***"); + } } SequentialFile file = factory.createSequentialFile(fileName); //to be sure that a process/thread crash won't leave the dataFolder with garbage files @@ -91,12 +104,13 @@ public class SyncCalculation { try { final ByteBuffer bufferBlock = allocateAlignedBlock(blockSize, factory); - final int alignedBlockSize = bufferBlock.remaining(); + // making sure the blockSize matches the device + blockSize = bufferBlock.remaining(); file.delete(); file.open(); - file.fill(alignedBlockSize * blocks); + file.fill(blockSize * blocks); file.close(); @@ -156,18 +170,32 @@ public class SyncCalculation { System.out.println("Writes / millisecond = " + dcformat.format(writesPerMillisecond)); System.out.println("bufferTimeout = " + toNanos(result[ntry], blocks, verbose)); System.out.println("**************************************************"); - if (writeLatencies != null) { - System.out.println("Write Latencies Percentile Distribution in microseconds"); - //print latencies in us -> (ns * 1000d) - writeLatencies.outputPercentileDistribution(System.out, 1000d); - writeLatencies.reset(); - } } file.close(); + + if (ntry == 0 && writeLatencies != null) { + writeLatencies.reset(); // discarding the first one.. some warmup time + } } factory.releaseDirectBuffer(bufferBlock); + if (writeLatencies != null) { + System.out.println("Write Latencies Percentile Distribution in microseconds"); + //print latencies in us -> (ns * 1000d) + + System.out.println("*****************************************************************"); + writeLatencies.outputPercentileDistribution(System.out, 1000d); + System.out.println(); + System.out.println("*****************************************************************"); + System.out.println("*** this may be useful to generate charts if you like charts: ***"); + System.out.println("*** http://hdrhistogram.github.io/HdrHistogram/plotFiles.html ***"); + System.out.println("*****************************************************************"); + System.out.println(); + + writeLatencies.reset(); + } + long totalTime = Long.MAX_VALUE; for (int i = 0; i < tries; i++) { if (result[i] < totalTime) {