org.apache.lucene.benchmark.byTask.tasks

Class PerfTask

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
AddDocTask, ClearStatsTask, CloseIndexTask, CloseReaderTask, CreateIndexTask, DeleteDocTask, NewRoundTask, OpenIndexTask, OpenReaderTask, OptimizeTask, ReadTask, ReportTask, ResetInputsTask, ResetSystemEraseTask, ResetSystemSoftTask, SetPropTask, TaskSequence

public abstract class PerfTask
extends Object
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.

Field Summary

protected static String
NEW_LINE
protected String
params

Constructor Summary

PerfTask(PerfRunData runData)

Method Summary

protected Object
clone()
abstract int
doLogic()
Perform the task once (ignoring repetions specification) Return number of work items done by this task.
int
getDepth()
String
getName()
String
getParams()
PerfRunData
getRunData()
int
runAndMaybeStats(boolean reportStats)
Run the task, record statistics.
void
setDepth(int depth)
protected void
setName(String name)
void
setParams(String params)
Set the params of this task.
void
setup()
Task setup work that should not be measured for that specific task.
protected boolean
shouldNeverLogAtStart()
Tasks that should never log at start can overide this.
protected boolean
shouldNotRecordStats()
Tasks that should not record statistics can overide this.
void
tearDown()
Task tearDown work that should not be measured for that specific task.
String
toString()

Field Details

NEW_LINE

protected static final String NEW_LINE

params

protected String params

Constructor Details

PerfTask

public PerfTask(PerfRunData runData)

Method Details

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.
Returns:
number of work items done by this task.

getDepth

public int getDepth()
Returns:
Returns the depth.

getName

public String getName()
Returns:
Returns the name.

getParams

public String getParams()
Returns:
Returns the Params.

getRunData

public PerfRunData getRunData()
Returns:
Returns the run data.

runAndMaybeStats

public final int runAndMaybeStats(boolean reportStats)
            throws Exception
Run the task, record statistics.
Returns:
number of work items done by this task.

setDepth

public void setDepth(int depth)
Parameters:
depth - The depth to set.

setName

protected void setName(String name)
Parameters:
name - The name to set.

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.
Returns:
true if this task should never log when it start.

shouldNotRecordStats

protected boolean shouldNotRecordStats()
Tasks that should not record statistics can overide this.
Returns:
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.