/** * Compute a title line for a report table * * @param longestOp size of longest op name in the table * @return the table title line. */ protected String tableTitle(String longestOp) { StringBuilder sb = new StringBuilder(); sb.append(Format.format(OP, longestOp)); sb.append(ROUND); sb.append(getRunData().getConfig().getColsNamesForValsByRound()); for (int i = 0; i < COLS.length; i++) { sb.append(COLS[i]); } return sb.toString(); }
/** * Compute a report line for the given task stat. * * @param longestOp size of longest op name in the table. * @param stat task stat to be printed. * @return the report line. */ protected String taskReportLine(String longestOp, TaskStats stat) { PerfTask task = stat.getTask(); StringBuilder sb = new StringBuilder(); sb.append(Format.format(task.getName(), longestOp)); String round = (stat.getRound() >= 0 ? "" + stat.getRound() : "-"); sb.append(Format.formatPaddLeft(round, ROUND)); sb.append(getRunData().getConfig().getColsValuesForValsByRound(stat.getRound())); sb.append(Format.format(stat.getNumRuns(), RUNCNT)); sb.append(Format.format(stat.getCount() / stat.getNumRuns(), RECCNT)); long elapsed = (stat.getElapsed() > 0 ? stat.getElapsed() : 1); // assume at least 1ms sb.append(Format.format(2, (float) (stat.getCount() * 1000.0 / elapsed), RECSEC)); sb.append(Format.format(2, (float) stat.getElapsed() / 1000, ELAPSED)); sb.append(Format.format(0, (float) stat.getMaxUsedMem() / stat.getNumRuns(), USEDMEM)); sb.append(Format.format(0, (float) stat.getMaxTotMem() / stat.getNumRuns(), TOTMEM)); return sb.toString(); }