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

RepSumByPrefTask

public class RepSumByPrefTask extends ReportTask
Report by-name-prefix statistics aggregated by name.
Other side effects: None.

Fields Summary
protected String
prefix
Constructors Summary
public RepSumByPrefTask(org.apache.lucene.benchmark.byTask.PerfRunData runData)

    super(runData);
  
Methods Summary
public intdoLogic()

    Report rp = reportSumByPrefix(getRunData().getPoints().taskStats());
    
    System.out.println();
    System.out.println("------------> Report Sum By Prefix ("+prefix+") ("+
        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.ReportreportSumByPrefix(java.util.List taskStats)

    // aggregate by task name
    int reported = 0;
    LinkedHashMap p2 = new LinkedHashMap();
    for (Iterator it = taskStats.iterator(); it.hasNext();) {
      TaskStats stat1 = (TaskStats) it.next();
      if (stat1.getElapsed()>=0 && stat1.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
        reported++;
        String name = stat1.getTask().getName();
        TaskStats stat2 = (TaskStats) p2.get(name);
        if (stat2 == null) {
          try {
            stat2 = (TaskStats) stat1.clone();
          } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
          }
          p2.put(name,stat2);
        } else {
          stat2.add(stat1);
        }
      }
    }
    // now generate report from secondary list p2    
    return genPartialReport(reported, p2, taskStats.size());
  
public voidsetPrefix(java.lang.String prefix)

    this.prefix = prefix;
  
public java.lang.StringtoString()

    return super.toString()+" "+prefix;