org.apache.lucene.benchmark.byTask.tasks
Class PerfTask
- Cloneable
public abstract class PerfTask
implements Cloneable
A (abstract) task to be tested for performance.
Every performance task extends this class, and provides its own doLogic() method,
which performss the actual task.
Tasks performing some work that should be measured for the task, can overide setup() and/or tearDown() and
placed that work there.
NEW_LINE
protected static final String NEW_LINE
params
protected String params
clone
protected Object clone()
throws CloneNotSupportedException
doLogic
public abstract int doLogic()
throws Exception
Perform the task once (ignoring repetions specification)
Return number of work items done by this task.
For indexing that can be number of docs added.
For warming that can be number of scanned items, etc.
- number of work items done by this task.
getDepth
public int getDepth()
getName
public String getName()
getParams
public String getParams()
runAndMaybeStats
public final int runAndMaybeStats(boolean reportStats)
throws Exception
Run the task, record statistics.
- number of work items done by this task.
setDepth
public void setDepth(int depth)
depth
- The depth to set.
setName
protected void setName(String name)
setParams
public void setParams(String params)
Set the params of this task.
Sub classes that supports parameters may overide this method for fetching/processing the params.
setup
public void setup()
throws Exception
Task setup work that should not be measured for that specific task.
By default it does nothing, but tasks can implement this, moving work from
doLogic() to this method. Only the work done in doLogicis measured for this task.
Notice that higher level (sequence) tasks containing this task would then
measure larger time than the sum of their contained tasks.
shouldNeverLogAtStart
protected boolean shouldNeverLogAtStart()
Tasks that should never log at start can overide this.
- true if this task should never log when it start.
shouldNotRecordStats
protected boolean shouldNotRecordStats()
Tasks that should not record statistics can overide this.
- true if this task should never record its statistics.
tearDown
public void tearDown()
throws Exception
Task tearDown work that should not be measured for that specific task.
By default it does nothing, but tasks can implement this, moving work from
doLogic() to this method. Only the work done in doLogicis measured for this task.
Notice that higher level (sequence) tasks containing this task would then
measure larger time than the sum of their contained tasks.
toString
public String toString()
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.