FileDocCategorySizeDatePackage
PerfRunData.javaAPI DocApache Lucene 2.1.06464Wed Feb 14 10:46:16 GMT 2007org.apache.lucene.benchmark.byTask

PerfRunData

public class PerfRunData extends Object
Data maintained by a performance test run.

Data includes:

  • Configuration.
  • Directory, Writer, Reader.
  • Docmaker and a few instances of QueryMaker.
  • Analyzer.
  • Statistics data which updated during the run.

Fields Summary
private org.apache.lucene.benchmark.byTask.stats.Points
points
private Directory
directory
private Analyzer
analyzer
private org.apache.lucene.benchmark.byTask.feeds.DocMaker
docMaker
private org.apache.lucene.benchmark.byTask.feeds.QueryMaker
searchQueryMaker
private org.apache.lucene.benchmark.byTask.feeds.QueryMaker
searchTravQueryMaker
private org.apache.lucene.benchmark.byTask.feeds.QueryMaker
searchTravRetQueryMaker
private IndexReader
indexReader
private IndexWriter
indexWriter
private org.apache.lucene.benchmark.byTask.utils.Config
config
Constructors Summary
public PerfRunData(org.apache.lucene.benchmark.byTask.utils.Config config)

    this.config = config;
    // analyzer (default is standard analyzer)
    analyzer = (Analyzer) Class.forName(config.get("analyzer",
        "org.apache.lucene.analysis.standard.StandardAnalyzer")).newInstance();
    // doc maker
    docMaker = (DocMaker) Class.forName(config.get("doc.maker",
        "org.apache.lucene.benchmark.byTask.utils.SimpleDocMaker")).newInstance();
    docMaker.setConfig(config);
    // query makers
    // we use separate (identical) instances for each "read" task type, so each can iterate the quries separately.
    Class qmkrClass = Class.forName(config.get("query.maker","org.apache.lucene.benchmark.byTask.utils.SimpleQueryMaker"));
    searchQueryMaker = (QueryMaker) qmkrClass.newInstance();
    searchQueryMaker.setConfig(config);
    searchTravQueryMaker = (QueryMaker) qmkrClass.newInstance();
    searchTravQueryMaker.setConfig(config);
    searchTravRetQueryMaker = (QueryMaker) qmkrClass.newInstance();
    searchTravRetQueryMaker.setConfig(config);
    // index stuff
    reinit(false);
    
    // statistic points
    points = new Points(config);
    
    if (Boolean.valueOf(config.get("log.queries","false")).booleanValue()) {
      System.out.println("------------> queries:");
      System.out.println(getSearchQueryMaker().printQueries());
    }

  
Methods Summary
public org.apache.lucene.analysis.AnalyzergetAnalyzer()

return
Returns the anlyzer.

    return analyzer;
  
public org.apache.lucene.benchmark.byTask.utils.ConfiggetConfig()

return
Returns the config.

    return config;
  
public org.apache.lucene.store.DirectorygetDirectory()

return
Returns the directory.

    return directory;
  
public org.apache.lucene.benchmark.byTask.feeds.DocMakergetDocMaker()

return
Returns the docMaker.

    return docMaker;
  
public org.apache.lucene.index.IndexReadergetIndexReader()

return
Returns the indexReader.

    return indexReader;
  
public org.apache.lucene.index.IndexWritergetIndexWriter()

return
Returns the indexWriter.

    return indexWriter;
  
public org.apache.lucene.benchmark.byTask.stats.PointsgetPoints()

return
Returns the points.

    return points;
  
public org.apache.lucene.benchmark.byTask.feeds.QueryMakergetSearchQueryMaker()

return
Returns the searchQueryMaker.

    return searchQueryMaker;
  
public org.apache.lucene.benchmark.byTask.feeds.QueryMakergetSearchTravQueryMaker()

    return searchTravQueryMaker;
  
public org.apache.lucene.benchmark.byTask.feeds.QueryMakergetSearchTravRetQueryMaker()

    return searchTravRetQueryMaker;
  
public voidreinit(boolean eraseIndex)


    // cleanup index
    if (indexWriter!=null) {
      indexWriter.close();
      indexWriter = null;
    }
    if (indexReader!=null) {
      indexReader.close();
      indexReader = null;
    }
    if (directory!=null) {
      directory.close();
    }
    
    // directory (default is ram-dir).
    if ("FSDirectory".equals(config.get("directory","RAMDirectory"))) {
      File workDir = new File("work");
      File indexDir = new File(workDir,"index");
      if (eraseIndex && indexDir.exists()) {
        FileUtils.fullyDelete(indexDir);
      }
      indexDir.mkdirs();
      directory = FSDirectory.getDirectory(indexDir, eraseIndex);
    } else {
      directory = new RAMDirectory();
    }

    // inputs
    resetInputs();
    
    // release unused stuff
    System.runFinalization();
    System.gc();
  
public voidresetInputs()

    docMaker.resetInputs();
    searchQueryMaker.resetInputs();
    searchTravQueryMaker.resetInputs();
    searchTravRetQueryMaker.resetInputs();
  
public voidsetDirectory(org.apache.lucene.store.Directory directory)

param
directory The directory to set.

    this.directory = directory;
  
public voidsetIndexReader(org.apache.lucene.index.IndexReader indexReader)

param
indexReader The indexReader to set.

    this.indexReader = indexReader;
  
public voidsetIndexWriter(org.apache.lucene.index.IndexWriter indexWriter)

param
indexWriter The indexWriter to set.

    this.indexWriter = indexWriter;