Search in sources :

Example 11 with TaskStats

use of org.apache.lucene.benchmark.byTask.stats.TaskStats in project lucene-solr by apache.

the class RepSumByPrefTask method reportSumByPrefix.

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());
}
Also used : TaskStats(org.apache.lucene.benchmark.byTask.stats.TaskStats) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

TaskStats (org.apache.lucene.benchmark.byTask.stats.TaskStats)11 LinkedHashMap (java.util.LinkedHashMap)4 Report (org.apache.lucene.benchmark.byTask.stats.Report)3 Points (org.apache.lucene.benchmark.byTask.stats.Points)1 Fields (org.apache.lucene.index.Fields)1 IndexReader (org.apache.lucene.index.IndexReader)1 MultiFields (org.apache.lucene.index.MultiFields)1 PostingsEnum (org.apache.lucene.index.PostingsEnum)1 Terms (org.apache.lucene.index.Terms)1 TermsEnum (org.apache.lucene.index.TermsEnum)1