FileDocCategorySizeDatePackage
RepSumByNameRoundTask.javaAPI DocApache Lucene 2.2.02823Sat Jun 16 22:20:58 BST 2007org.apache.lucene.benchmark.byTask.tasks

RepSumByNameRoundTask

public class RepSumByNameRoundTask extends ReportTask
Report all statistics grouped/aggregated by name and round.
Other side effects: None.

Fields Summary
Constructors Summary
public RepSumByNameRoundTask(org.apache.lucene.benchmark.byTask.PerfRunData runData)

    super(runData);
  
Methods Summary
public intdoLogic()

    Report rp = reportSumByNameRound(getRunData().getPoints().taskStats());

    System.out.println();
    System.out.println("------------> Report Sum By (any) Name and Round ("+
        rp.getSize()+" about "+rp.getReported()+" out of "+rp.getOutOf()+")");
    System.out.println(rp.getText());
    System.out.println();
    
    return 0;
  
protected org.apache.lucene.benchmark.byTask.stats.ReportreportSumByNameRound(java.util.List taskStats)
Report statistics as a string, aggregate for tasks named the same, and from the same round.

return
the report

    // aggregate by task name and round
    LinkedHashMap p2 = new LinkedHashMap();
    int reported = 0;
    for (Iterator it = taskStats.iterator(); it.hasNext();) {
      TaskStats stat1 = (TaskStats) it.next();
      if (stat1.getElapsed()>=0) { // consider only tasks that ended
        reported++;
        String name = stat1.getTask().getName();
        String rname = stat1.getRound()+"."+name; // group by round
        TaskStats stat2 = (TaskStats) p2.get(rname);
        if (stat2 == null) {
          try {
            stat2 = (TaskStats) stat1.clone();
          } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
          }
          p2.put(rname,stat2);
        } else {
          stat2.add(stat1);
        }
      }
    }
    // now generate report from secondary list p2    
    return genPartialReport(reported, p2, taskStats.size());