private void logProgress(TestPhase phase, long elapsedMs, long durationMs) { String msg; if (durationMs == Long.MAX_VALUE) { msg = format("%s %s", phase == RUN ? "Running" : "Warming up ", secondsToHuman(MILLISECONDS.toSeconds(elapsedMs))); } else { msg = format("%s %s (%s%%)", phase == RUN ? "Running" : "Warming up ", secondsToHuman(MILLISECONDS.toSeconds(elapsedMs)), formatPercentage(elapsedMs, durationMs)); } if (performanceMonitorIntervalSeconds > 0) { msg += performanceStatsCollector.formatIntervalPerformanceNumbers(testCase.getId()); } LOGGER.info(prefix + msg); }
public String detailedPerformanceInfo(String testId, long runningTimeMs) { PerformanceStats totalPerformanceStats = new PerformanceStats(); Map<SimulatorAddress, PerformanceStats> agentPerformanceStatsMap = new HashMap<SimulatorAddress, PerformanceStats>(); calculatePerformanceStats(testId, totalPerformanceStats, agentPerformanceStatsMap); long totalOperationCount = totalPerformanceStats.getOperationCount(); if (totalOperationCount < 1) { return "Performance information is not available!"; } double runningTimeSeconds = (runningTimeMs * 1d) / SECONDS.toMillis(1); StringBuilder sb = new StringBuilder(); sb.append(format("Total throughput %s%% %s ops %s ops/s\n", formatPercentage(1, 1), formatLong(totalOperationCount, OPERATION_COUNT_FORMAT_LENGTH), formatDouble(totalOperationCount / runningTimeSeconds, THROUGHPUT_FORMAT_LENGTH))); for (SimulatorAddress address : sort(agentPerformanceStatsMap.keySet())) { PerformanceStats performanceStats = agentPerformanceStatsMap.get(address); long operationCount = performanceStats.getOperationCount(); sb.append(format(" Agent %-15s %s%% %s ops %s ops/s\n", address, formatPercentage(operationCount, totalOperationCount), formatLong(operationCount, OPERATION_COUNT_FORMAT_LENGTH), formatDouble(operationCount / runningTimeSeconds, THROUGHPUT_FORMAT_LENGTH))); } return sb.toString(); }