1 package org.apache.lucene.benchmark.byTask.tasks;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import java.util.List;
22 import org.apache.lucene.benchmark.byTask.PerfRunData;
23 import org.apache.lucene.benchmark.byTask.stats.Report;
24 import org.apache.lucene.benchmark.byTask.stats.TaskStats;
27 * Report by-name-prefix statistics with no aggregations.
28 * <br>Other side effects: None.
30 public class RepSelectByPrefTask extends RepSumByPrefTask {
32 public RepSelectByPrefTask(PerfRunData runData) {
37 public int doLogic() throws Exception {
38 Report rp = reportSelectByPrefix(getRunData().getPoints().taskStats());
41 System.out.println("------------> Report Select By Prefix ("+prefix+") ("+
42 rp.getSize()+" about "+rp.getReported()+" out of "+rp.getOutOf()+")");
43 System.out.println(rp.getText());
49 protected Report reportSelectByPrefix(List<TaskStats> taskStats) {
50 String longestOp = longestOp(taskStats);
52 StringBuilder sb = new StringBuilder();
53 sb.append(tableTitle(longestOp));
56 for (final TaskStats stat : taskStats) {
57 if (stat.getElapsed()>=0 && stat.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
63 String line = taskReportLine(longestOp,stat);
64 if (taskStats.size()>2 && reported%2==0) {
65 line = line.replaceAll(" "," - ");
70 String reptxt = (reported==0 ? "No Matching Entries Were Found!" : sb.toString());
71 return new Report(reptxt,reported,reported, taskStats.size());