String (@NotNull CpuUsageData data, int expectedOnMyMachine, int actualInputSize, int actualUsedCpuCores, @NotNull IterationResult iterationResult, int initialMaxRetries) { long duration = data.durationMs; int percentage = (int)(100.0 * (duration - expectedOnMyMachine) / expectedOnMyMachine); String colorCode = iterationResult == IterationResult.ACCEPTABLE ? "32;1m" : // green iterationResult == IterationResult.BORDERLINE ? "33;1m" : // yellow "31;1m"; // red return what+" took \u001B[" + colorCode + Math.abs(percentage) + "% " + (percentage > 0 ? "more" : "less") + " time\u001B[0m than expected" + (iterationResult == IterationResult.DISTRACTED && initialMaxRetries != 1 ? " (but JIT compilation took too long, will retry anyway)" : "") + "\n Expected: " + expectedOnMyMachine + "ms" + (expectedOnMyMachine < 1000 ? "" : " (" + StringUtil.formatDuration(expectedOnMyMachine) + ")") + "\n Actual: " + duration + "ms" + (duration < 1000 ? "" : " (" + StringUtil.formatDuration(duration) + ")") + (expectedInputSize != actualInputSize ? "\n (Expected time was adjusted accordingly to input size: expected " + expectedInputSize + ", actual " + actualInputSize + ".)": "") + (usedReferenceCpuCores != actualUsedCpuCores ? "\n (Expected time was adjusted accordingly to number of available CPU cores: reference CPU has " + usedReferenceCpuCores + ", actual value is " + actualUsedCpuCores + ".)": "") + "\n Timings: " + Timings.getStatistics() + "\n Threads: " + data.getThreadStats() + "\n GC stats: " + data.getGcStats() + "\n Process: " + data.getProcessCpuStats(); }