edu.jhu.ece.iacl.jist.pipeline
Class PerformanceSummary

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PerformanceSummary
All Implemented Interfaces:
java.lang.Cloneable

public class PerformanceSummary
extends java.lang.Object
implements java.lang.Cloneable

Summary of start and stop times for different tasks within an algorithm. This class also records the used and total memory at the time a task completes.

Author:
Blake Lucas

Nested Class Summary
protected static class PerformanceSummary.TimeAndMemoryStamp
          The Class TimeAndMemoryStamp.
 
Field Summary
protected  java.util.ArrayList<PerformanceSummary> children
          Children performance summaries.
protected  java.lang.management.ThreadMXBean tb
          Thread to get cpu time.
protected  java.util.ArrayList<PerformanceSummary.TimeAndMemoryStamp> timeAndMemStamps
          List of time and memory stamps for different algorithm steps.
 
Constructor Summary
PerformanceSummary()
          Default constructor.
 
Method Summary
 PerformanceSummary clone()
          Returns clone of performance summary.
static java.lang.String formatTime(long time)
          Format millisecond time to be in terms of days, hrs, minutes, and seconds.
 java.util.ArrayList<java.lang.Long> getAllElapsedActualTimes()
          Get list of elapsed times in msec.
 java.util.ArrayList<java.lang.Long> getAllElapsedCPUTimes()
          Get list of elapsed times in msec.
 java.util.ArrayList<java.lang.String> getAllTaskNames()
          Get list of task names.
 int getPeakAllocatedMemory()
          Get peak allocated memory.
 int getPeakUsedMemory()
          Get peak used memory.
 java.lang.String getSummary()
          Return long summary of elapsed time.
 long getTotalElapsedActualTime()
          Get cumulative elapsed time for all tasks in msec.
 long getTotalElapsedCPUTime()
          Get cumulative elapsed time for all tasks in msec.
 void record(PerformanceSummary child)
          Add child performance summary to this summary.
 void record(java.lang.String label, long startTime, long stopTime, long realStartTime, long realStopTime)
          Record completion of task.
 java.lang.String toString()
          Return short summary of elapsed time.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timeAndMemStamps

protected java.util.ArrayList<PerformanceSummary.TimeAndMemoryStamp> timeAndMemStamps
List of time and memory stamps for different algorithm steps.


children

protected java.util.ArrayList<PerformanceSummary> children
Children performance summaries.


tb

protected transient java.lang.management.ThreadMXBean tb
Thread to get cpu time.

Constructor Detail

PerformanceSummary

public PerformanceSummary()
Default constructor.

Method Detail

clone

public PerformanceSummary clone()
Returns clone of performance summary.

Overrides:
clone in class java.lang.Object
Returns:
the performance summary

formatTime

public static java.lang.String formatTime(long time)
Format millisecond time to be in terms of days, hrs, minutes, and seconds.

Parameters:
time - elapsed time in milliseconds
Returns:
time string

getAllElapsedCPUTimes

public java.util.ArrayList<java.lang.Long> getAllElapsedCPUTimes()
Get list of elapsed times in msec.

Returns:
the all elapsed times

getAllElapsedActualTimes

public java.util.ArrayList<java.lang.Long> getAllElapsedActualTimes()
Get list of elapsed times in msec.

Returns:
the all elapsed times

getAllTaskNames

public java.util.ArrayList<java.lang.String> getAllTaskNames()
Get list of task names.

Returns:
the all task names

getPeakAllocatedMemory

public int getPeakAllocatedMemory()
Get peak allocated memory.

Returns:
the peak allocated memory

getPeakUsedMemory

public int getPeakUsedMemory()
Get peak used memory.

Returns:
the peak used memory

getSummary

public java.lang.String getSummary()
Return long summary of elapsed time.

Returns:
the summary

getTotalElapsedCPUTime

public long getTotalElapsedCPUTime()
Get cumulative elapsed time for all tasks in msec.

Returns:
the total elapsed time

getTotalElapsedActualTime

public long getTotalElapsedActualTime()
Get cumulative elapsed time for all tasks in msec.

Returns:
the total elapsed time

record

public void record(PerformanceSummary child)
Add child performance summary to this summary.

Parameters:
child - the child

record

public void record(java.lang.String label,
                   long startTime,
                   long stopTime,
                   long realStartTime,
                   long realStopTime)
Record completion of task.

Parameters:
label - taskName
startTime - Start Time in msec
stopTime - Stop Time in msec
realStartTime - the real start time
realStopTime - the real stop time

toString

public java.lang.String toString()
Return short summary of elapsed time.

Overrides:
toString in class java.lang.Object
Returns:
the string