Class PerfTask
java.lang.Object
org.apache.lucene.benchmark.byTask.tasks.PerfTask
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AddDocTask
,AddIndexesTask
,AnalyzerFactoryTask
,ClearStatsTask
,CloseIndexTask
,CloseReaderTask
,CloseTaxonomyIndexTask
,CloseTaxonomyReaderTask
,CommitIndexTask
,CommitTaxonomyIndexTask
,ConsumeContentSourceTask
,CreateIndexTask
,CreateTaxonomyIndexTask
,FlushIndexTask
,ForceMergeTask
,NearRealtimeReaderTask
,NewAnalyzerTask
,NewCollationAnalyzerTask
,NewLocaleTask
,NewRoundTask
,OpenIndexTask
,OpenReaderTask
,OpenTaxonomyIndexTask
,OpenTaxonomyReaderTask
,PrintReaderTask
,ReadTask
,ReadTokensTask
,ReopenReaderTask
,ReportTask
,ResetInputsTask
,RollbackIndexTask
,SetPropTask
,TaskSequence
,UpdateDocTask
,WaitTask
,WriteLineDocTask
An abstract task to be tested for performance.
Every performance task extends this class, and provides its own
Tasks performing some work that should be measured for the task, can override
Relevant properties:
Also supports the following logging attributes:
Every performance task extends this class, and provides its own
doLogic()
method, which
performs the actual task. Tasks performing some work that should be measured for the task, can override
setup()
and/or tearDown()
and place that work there. Relevant properties:
task.max.depth.log
.Also supports the following logging attributes:
- log.step - specifies how often to log messages about the current running task. Default is
1000
doLogic()
invocations. Set to -1 to disable logging. - log.step.[class Task Name] - specifies the same as 'log.step', only for a particular task
name. For example, log.step.AddDoc will be applied only for
AddDocTask
. It's a way to control per task logging settings. If you want to omit logging for any other task, include log.step=-1. The syntax is "log.step." together with the Task's 'short' name (i.e., without the 'Task' part).
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected PerfTask
clone()
void
close()
abstract int
doLogic()
Perform the task once (ignoring repetitions specification) Return number of work items done by this task.int
int
int
getDepth()
protected String
getLogMessage
(int recsCount) getName()
boolean
boolean
Return true if counting is disabled for this task.final int
runAndMaybeStats
(boolean reportStats) Run the task, record statistics.void
setAlgLineNum
(int algLineNum) void
setDepth
(int depth) void
setDisableCounting
(boolean disableCounting) protected void
void
Set the params of this task.void
setRunInBackground
(int deltaPri) void
setup()
Task setup work that should not be measured for that specific task.protected boolean
Tasks that should never log at start can override this.protected boolean
Tasks that should not record statistics can override this.void
stopNow()
boolean
Sub classes that support parameters must override this method to return true.void
tearDown()
Task tearDown work that should not be measured for that specific task.toString()
-
Field Details
-
logStep
protected int logStep -
params
-
NEW_LINE
-
stopNow
protected volatile boolean stopNow
-
-
Constructor Details
-
PerfTask
-
-
Method Details
-
setRunInBackground
public void setRunInBackground(int deltaPri) -
getRunInBackground
public boolean getRunInBackground() -
getBackgroundDeltaPriority
public int getBackgroundDeltaPriority() -
stopNow
public void stopNow() -
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
close
- Throws:
Exception
-
runAndMaybeStats
Run the task, record statistics.- Returns:
- number of work items done by this task.
- Throws:
Exception
-
doLogic
Perform the task once (ignoring repetitions 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.
- Throws:
Exception
-
getName
- Returns:
- Returns the name.
-
setName
- Parameters:
name
- The name to set.
-
getRunData
- Returns:
- Returns the run data.
-
getDepth
public int getDepth()- Returns:
- Returns the depth.
-
setDepth
public void setDepth(int depth) - Parameters:
depth
- The depth to set.
-
toString
-
getLogMessage
-
shouldNeverLogAtStart
protected boolean shouldNeverLogAtStart()Tasks that should never log at start can override this.- Returns:
- true if this task should never log when it start.
-
shouldNotRecordStats
protected boolean shouldNotRecordStats()Tasks that should not record statistics can override this.- Returns:
- true if this task should never record its statistics.
-
setup
Task setup work that should not be measured for that specific task. By default it does nothing, but tasks can implement this, moving work fromdoLogic()
to this method. Only the work done indoLogic()
is 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.- Throws:
Exception
-
tearDown
Task tearDown work that should not be measured for that specific task. By default it does nothing, but tasks can implement this, moving work fromdoLogic()
to this method. Only the work done indoLogic()
is 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.- Throws:
Exception
-
supportsParams
public boolean supportsParams()Sub classes that support parameters must override this method to return true.- Returns:
- true iff this task supports command line params.
-
setParams
Set the params of this task.- Throws:
UnsupportedOperationException
- for tasks supporting command line parameters.
-
getParams
- Returns:
- Returns the Params.
-
isDisableCounting
public boolean isDisableCounting()Return true if counting is disabled for this task. -
setDisableCounting
public void setDisableCounting(boolean disableCounting) -
setAlgLineNum
public void setAlgLineNum(int algLineNum) -
getAlgLineNum
public int getAlgLineNum()
-