Package org.apache.lucene.benchmark.byTask.stats

Examples of org.apache.lucene.benchmark.byTask.stats.TaskStats


    StringBuffer sb = new StringBuffer();
    sb.append(tableTitle(longestOp));
    sb.append(newline);
    int reported = 0;
    for (Iterator it = taskStats.iterator(); it.hasNext();) {
      TaskStats stat = (TaskStats) it.next();
      if (stat.getElapsed()>=0 && stat.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
        reported++;
        if (!first) {
          sb.append(newline);
        }
        first = false;
View Full Code Here


    sb.append(tableTitle(longestOp));
    sb.append(newline);
    int reported = 0;
    Iterator it = taskStats.iterator();
    while (it.hasNext()) {
      TaskStats stat = (TaskStats) it.next();
      if (stat.getElapsed()>=0) { // consider only tasks that ended
        if (!first) {
          sb.append(newline);
        }
        first = false;
        String line = taskReportLine(longestOp, stat);
View Full Code Here

   * @return the longest op name out of completed tasks.
   */
  protected String longestOp(Iterator taskStats) {
    String longest = OP;
    while (taskStats.hasNext()) {
      TaskStats stat = (TaskStats) taskStats.next();
      if (stat.getElapsed()>=0) { // consider only tasks that ended
        String name = stat.getTask().getName();
        if (name.length() > longest.length()) {
          longest = name;
        }
      }
    }
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb.append(tableTitle(longetOp));
    sb.append(newline);
    int lineNum = 0;
    for (Iterator it = partOfTasks.values().iterator(); it.hasNext();) {
      TaskStats stat = (TaskStats) it.next();
      if (!first) {
        sb.append(newline);
      }
      first = false;
      String line = taskReportLine(longetOp,stat);
View Full Code Here

  protected Report reportSumByPrefixRound(List taskStats) {
    // aggregate by task name and by round
    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();
        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());
View Full Code Here

  protected Report reportSumByPrefix (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());
View Full Code Here

    List stats = benchmark.getRunData().getPoints().taskStats();

    // Count how many tokens all ReadTokens saw
    int totalTokenCount1 = 0;
    for (Iterator it = stats.iterator(); it.hasNext();) {
      TaskStats stat = (TaskStats) it.next();
      if (stat.getTask().getName().equals("ReadTokens")) {
        totalTokenCount1 += stat.getCount();
      }
    }

    // Separately count how many tokens are actually in the index:
    IndexReader reader = IndexReader.open(benchmark.getRunData().getDirectory());
View Full Code Here

    // 3. test counters
    int n = disable ? 0 : 1;
    int nChecked = 0;
    for (Iterator ts = benchmark.getRunData().getPoints().taskStats().iterator(); ts.hasNext();) {
      TaskStats stats = (TaskStats) ts.next();
      String taskName = stats.getTask().getName();
      if (taskName.equals("Rounds")) {
        assertEquals("Wrong total count!",20+2*n,stats.getCount());
        nChecked++;
      } else if (taskName.equals("CreateIndex")) {
        assertEquals("Wrong count for CreateIndex!",n,stats.getCount());
        nChecked++;
      } else if (taskName.equals("CloseIndex")) {
        assertEquals("Wrong count for CloseIndex!",n,stats.getCount());
        nChecked++;
      }
    }
    assertEquals("Missing some tasks to check!",3,nChecked);
  }
View Full Code Here

  protected Report reportSumByName(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) { // consider only tasks that ended
        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());
View Full Code Here

    List stats = benchmark.getRunData().getPoints().taskStats();

    // Count how many tokens all ReadTokens saw
    int totalTokenCount1 = 0;
    for (Iterator it = stats.iterator(); it.hasNext();) {
      TaskStats stat = (TaskStats) it.next();
      if (stat.getTask().getName().equals("ReadTokens")) {
        totalTokenCount1 += stat.getCount();
      }
    }

    // Separately count how many tokens are actually in the index:
    IndexReader reader = IndexReader.open(benchmark.getRunData().getDirectory());
View Full Code Here

TOP

Related Classes of org.apache.lucene.benchmark.byTask.stats.TaskStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.