• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TaskStats类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.lucene.benchmark.byTask.stats.TaskStats的典型用法代码示例。如果您正苦于以下问题:Java TaskStats类的具体用法?Java TaskStats怎么用?Java TaskStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

TaskStats类属于org.apache.lucene.benchmark.byTask.stats包,在下文中一共展示了TaskStats类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: reportAll

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * Report detailed statistics as a string
 * @return the report
 */
protected Report reportAll(List<TaskStats> taskStats) {
  String longestOp = longestOp(taskStats);
  boolean first = true;
  StringBuilder sb = new StringBuilder();
  sb.append(tableTitle(longestOp));
  sb.append(newline);
  int reported = 0;
  for (final TaskStats stat : taskStats) {
    if (stat.getElapsed()>=0) { // consider only tasks that ended
      if (!first) {
        sb.append(newline);
      }
      first = false;
      String line = taskReportLine(longestOp, stat);
      reported++;
      if (taskStats.size()>2 && reported%2==0) {
        line = line.replaceAll("   "," - ");
      }
      sb.append(line);
    }
  }
  String reptxt = (reported==0 ? "No Matching Entries Were Found!" : sb.toString());
  return new Report(reptxt,reported,reported,taskStats.size());
}
 

开发者ID:europeana,
项目名称:search,
代码行数:29,
代码来源:RepAllTask.java

示例2: reportSumByPrefix

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
protected Report reportSumByPrefix (List<TaskStats> taskStats) {
  // aggregate by task name
  int reported = 0;
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<>();
  for (final TaskStats stat1 : taskStats) {
    if (stat1.getElapsed()>=0 && stat1.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
      reported++;
      String name = stat1.getTask().getName();
      TaskStats stat2 = p2.get(name);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:europeana,
项目名称:search,
代码行数:25,
代码来源:RepSumByPrefTask.java

示例3: reportSumByName

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * Report statistics as a string, aggregate for tasks named the same.
 * @return the report
 */
protected Report reportSumByName(List<TaskStats> taskStats) {
  // aggregate by task name
  int reported = 0;
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<>();
  for (final TaskStats stat1: taskStats) {
    if (stat1.getElapsed()>=0) { // consider only tasks that ended
      reported++;
      String name = stat1.getTask().getName();
      TaskStats stat2 = p2.get(name);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:europeana,
项目名称:search,
代码行数:29,
代码来源:RepSumByNameTask.java

示例4: reportSelectByPrefix

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
protected Report reportSelectByPrefix(List<TaskStats> taskStats) {
  String longestOp = longestOp(taskStats);
  boolean first = true;
  StringBuilder sb = new StringBuilder();
  sb.append(tableTitle(longestOp));
  sb.append(newline);
  int reported = 0;
  for (final TaskStats stat : taskStats) {
    if (stat.getElapsed()>=0 && stat.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
      reported++;
      if (!first) {
        sb.append(newline);
      }
      first = false;
      String line = taskReportLine(longestOp,stat);
      if (taskStats.size()>2 && reported%2==0) {
        line = line.replaceAll("   "," - ");
      }
      sb.append(line);
    }
  }
  String reptxt = (reported==0 ? "No Matching Entries Were Found!" : sb.toString());
  return new Report(reptxt,reported,reported, taskStats.size());
}
 

开发者ID:europeana,
项目名称:search,
代码行数:25,
代码来源:RepSelectByPrefTask.java

示例5: reportSumByPrefixRound

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
protected Report reportSumByPrefixRound(List<TaskStats> taskStats) {
  // aggregate by task name and by round
  int reported = 0;
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<>();
  for (final TaskStats stat1 : taskStats) {
    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 = p2.get(rname);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:europeana,
项目名称:search,
代码行数:26,
代码来源:RepSumByPrefRoundTask.java

示例6: reportSumByNameRound

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * Report statistics as a string, aggregate for tasks named the same, and from the same round.
 * @return the report
 */
protected Report reportSumByNameRound(List<TaskStats> taskStats) {
  // aggregate by task name and round
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<>();
  int reported = 0;
  for (final TaskStats stat1 : taskStats) {
    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 = p2.get(rname);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:europeana,
项目名称:search,
代码行数:30,
代码来源:RepSumByNameRoundTask.java

示例7: taskReportLine

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * 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();
}
 

开发者ID:europeana,
项目名称:search,
代码行数:23,
代码来源:ReportTask.java

示例8: doTestDisableCounting

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
private void doTestDisableCounting(boolean disable) throws Exception {
  // 1. alg definition (required in every "logic" test)
  String algLines[] = disableCountingLines(disable);
  
  // 2. execute the algorithm  (required in every "logic" test)
  Benchmark benchmark = execBenchmark(algLines);

  // 3. test counters
  int n = disable ? 0 : 1;
  int nChecked = 0;
  for (final TaskStats stats : benchmark.getRunData().getPoints().taskStats()) {
    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);
}
 

开发者ID:europeana,
项目名称:search,
代码行数:26,
代码来源:TestPerfTasksLogic.java

示例9: reportSumByPrefix

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
protected Report reportSumByPrefix (List<TaskStats> taskStats) {
  // aggregate by task name
  int reported = 0;
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<String,TaskStats>();
  for (final TaskStats stat1 : taskStats) {
    if (stat1.getElapsed()>=0 && stat1.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
      reported++;
      String name = stat1.getTask().getName();
      TaskStats stat2 = p2.get(name);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:25,
代码来源:RepSumByPrefTask.java

示例10: reportSumByName

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * Report statistics as a string, aggregate for tasks named the same.
 * @return the report
 */
protected Report reportSumByName(List<TaskStats> taskStats) {
  // aggregate by task name
  int reported = 0;
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<String,TaskStats>();
  for (final TaskStats stat1: taskStats) {
    if (stat1.getElapsed()>=0) { // consider only tasks that ended
      reported++;
      String name = stat1.getTask().getName();
      TaskStats stat2 = p2.get(name);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:29,
代码来源:RepSumByNameTask.java

示例11: reportSumByPrefixRound

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
protected Report reportSumByPrefixRound(List<TaskStats> taskStats) {
  // aggregate by task name and by round
  int reported = 0;
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<String,TaskStats>();
  for (final TaskStats stat1 : taskStats) {
    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 = p2.get(rname);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:26,
代码来源:RepSumByPrefRoundTask.java

示例12: reportSumByNameRound

点赞 3

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * Report statistics as a string, aggregate for tasks named the same, and from the same round.
 * @return the report
 */
protected Report reportSumByNameRound(List<TaskStats> taskStats) {
  // aggregate by task name and round
  LinkedHashMap<String,TaskStats> p2 = new LinkedHashMap<String,TaskStats>();
  int reported = 0;
  for (final TaskStats stat1 : taskStats) {
    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 = p2.get(rname);
      if (stat2 == null) {
        try {
          stat2 = 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());
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:30,
代码来源:RepSumByNameRoundTask.java

示例13: longestOp

点赞 2

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
/**
 * 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;
}
 

开发者ID:europeana,
项目名称:search,
代码行数:18,
代码来源:ReportTask.java

示例14: genPartialReport

点赞 2

import org.apache.lucene.benchmark.byTask.stats.TaskStats; //导入依赖的package包/类
protected Report genPartialReport(int reported, LinkedHashMap<String,TaskStats> partOfTasks, int totalSize) {
  String longetOp = longestOp(partOfTasks.values());
  boolean first = true;
  StringBuilder sb = new StringBuilder();
  sb.append(tableTitle(longetOp));
  sb.append(newline);
  int lineNum = 0;
  for (final TaskStats stat : partOfTasks.values()) {
    if (!first) {
      sb.append(newline);
    }
    first = false;
    String line = taskReportLine(longetOp,stat);
    lineNum++;
    if (partOfTasks.size()>2 && lineNum%2==0) {
      line = line.replaceAll("   "," - ");
    }
    sb.append(line);
    int[] byTime = stat.getCountsByTime();
    if (byTime != null) {
      sb.append(newline);
      int end = -1;
      for(int i=byTime.length-1;i>=0;i--) {
        if (byTime[i] != 0) {
          end = i;
          break;
        }
      }
      if (end != -1) {
        sb.append("  by time:");
        for(int i=0;i<end;i++) {
          sb.append(' ').append(byTime[i]);
        }
      }
    }
  }
  
  String reptxt = (reported==0 ? "No Matching Entries Were Found!" : sb.toString());
  return new Report(reptxt,partOfTasks.size(),reported,totalSize);
}
 

开发者ID:europeana,
项目名称:search,
代码行数:41,
代码来源:ReportTask.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)