Methods Summary |
---|
protected java.lang.Object | clone()
// tasks having non primitive data structures should overide this.
// otherwise parallel running of a task sequence might not run crrectly.
return super.clone();
|
public abstract int | doLogic()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.
|
public int | getDepth()
return depth;
|
int | getMaxDepthLogStart()
return maxDepthLogStart;
|
public java.lang.String | getName()
if (params==null) {
return name;
}
return new StringBuffer(name).append('(").append(params).append(')").toString();
|
java.lang.String | getPadding()
char c[] = new char[4*getDepth()];
for (int i = 0; i < c.length; i++) c[i] = ' ";
return new String(c);
|
public java.lang.String | getParams()
return params;
|
public org.apache.lucene.benchmark.byTask.PerfRunData | getRunData()
return runData;
|
public final int | runAndMaybeStats(boolean reportStats)Run the task, record statistics.
if (reportStats && depth <= maxDepthLogStart && !shouldNeverLogAtStart()) {
System.out.println("------------> starting task: " + getName());
}
if (shouldNotRecordStats() || !reportStats) {
setup();
int count = doLogic();
tearDown();
return count;
}
setup();
Points pnts = runData.getPoints();
TaskStats ts = pnts.markTaskStart(this,runData.getConfig().getRoundNumber());
int count = doLogic();
pnts.markTaskEnd(ts, count);
tearDown();
return count;
|
public void | setDepth(int depth)
this.depth = depth;
|
protected void | setName(java.lang.String name)
this.name = name;
|
public void | setParams(java.lang.String params)Set the params of this task.
if (!supportsParams()) {
throw new UnsupportedOperationException(getName()+" does not support command line parameters.");
}
this.params = params;
|
public void | 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 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.
|
protected boolean | shouldNeverLogAtStart()Tasks that should never log at start can overide this.
return false;
|
protected boolean | shouldNotRecordStats()Tasks that should not record statistics can overide this.
return false;
|
public boolean | supportsParams()Sub classes that supports parameters must overide this method to return true.
return false;
|
public void | 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 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.
|
public java.lang.String | toString()
String padd = getPadding();
StringBuffer sb = new StringBuffer(padd);
sb.append(getName());
return sb.toString();
|