FileDocCategorySizeDatePackage
TaskStats.javaAPI DocApache Lucene 2.2.04788Sat Jun 16 22:21:00 BST 2007org.apache.lucene.benchmark.byTask.stats

TaskStats

public class TaskStats extends Object implements Cloneable
Statistics for a task run.
The same task can run more than once, but, if that task records statistics, each run would create its own TaskStats.

Fields Summary
private org.apache.lucene.benchmark.byTask.tasks.PerfTask
task
task for which data was collected
private int
round
round in which task run started
private long
start
task start time
private long
elapsed
task elapsed time. elapsed >= 0 indicates run completion!
private long
maxTotMem
max tot mem during task
private long
maxUsedMem
max used mem during task
private int
taskRunNum
serial run number of this task run in the perf run
private int
numParallelTasks
number of other tasks that started to run while this task was still running
private int
count
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. For repeating tasks, this is a sum over repetitions.
private int
numRuns
Number of similar tasks aggregated into this record. Used when summing up on few runs/instances of similar tasks.
Constructors Summary
TaskStats(org.apache.lucene.benchmark.byTask.tasks.PerfTask task, int taskRunNum, int round)
Create a run data for a task that is starting now. To be called from Points.

  
                     
         
    this.task = task;
    this.taskRunNum = taskRunNum;
    this.round = round;
    maxTotMem = Runtime.getRuntime().totalMemory();
    maxUsedMem = maxTotMem - Runtime.getRuntime().freeMemory();
    start = System.currentTimeMillis();
  
Methods Summary
public voidadd(org.apache.lucene.benchmark.byTask.stats.TaskStats stat2)
Add data from another stat, for aggregation

param
stat2 the added stat data.

    numRuns += stat2.getNumRuns();
    elapsed += stat2.getElapsed();
    maxTotMem += stat2.getMaxTotMem();
    maxUsedMem += stat2.getMaxUsedMem();
    count += stat2.getCount();
    if (round != stat2.round) {
      round = -1; // no meaning if agregating tasks of different ruond. 
    }
  
public java.lang.Objectclone()

    return super.clone();
  
public intgetCount()

return
Returns the count.

    return count;
  
public longgetElapsed()

return
elapsed time.

    return elapsed;
  
public longgetMaxTotMem()

return
Returns the maxTotMem.

    return maxTotMem;
  
public longgetMaxUsedMem()

return
Returns the maxUsedMem.

    return maxUsedMem;
  
public intgetNumParallelTasks()

return
Returns the numParallelTasks.

    return numParallelTasks;
  
public intgetNumRuns()

return
Returns the numRuns.

    return numRuns;
  
public intgetRound()

return
the round number.

    return round;
  
public org.apache.lucene.benchmark.byTask.tasks.PerfTaskgetTask()

return
Returns the task.

    return task;
  
public intgetTaskRunNum()

return
the taskRunNum.

    return taskRunNum;
  
voidmarkEnd(int numParallelTasks, int count)
mark the end of a task

    elapsed = System.currentTimeMillis() - start;
    long totMem = Runtime.getRuntime().totalMemory();
    if (totMem > maxTotMem) {
      maxTotMem = totMem;
    }
    long usedMem = totMem - Runtime.getRuntime().freeMemory();
    if (usedMem > maxUsedMem) {
      maxUsedMem = usedMem;
    }
    this.numParallelTasks = numParallelTasks;
    this.count = count;
  
public java.lang.StringtoString()

    StringBuffer res = new StringBuffer(task.getName());
    res.append(" ");
    res.append(count);
    res.append(" ");
    res.append(elapsed);
    return res.toString();