Пример #1
0
 /**
  * find the longest op name out of completed tasks.
  *
  * @param taskStats completed tasks to be considered.
  * @return the longest op name out of completed tasks.
  */
 protected String longestOp(Iterable<TaskStats> taskStats) {
   String longest = OP;
   for (final TaskStats stat : taskStats) {
     if (stat.getElapsed() >= 0) { // consider only tasks that ended
       String name = stat.getTask().getName();
       if (name.length() > longest.length()) {
         longest = name;
       }
     }
   }
   return longest;
 }
Пример #2
0
 /**
  * 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();
 }