Package randoop.util
Class ProgressDisplay
- java.lang.Object
-
- java.lang.Thread
-
- randoop.util.ProgressDisplay
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProgressDisplay.Mode
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private static int
exit_if_no_steps_after_milliseconds
Give up after this many milliseconds, if the generator has not taken a step.private AbstractGenerator
generator
The test generator.private long
lastNumSteps
The step number of the most recent step.private long
lastStepTime
When the most recent step completed.private ProgressDisplay.Mode
outputMode
The output mode.static Object
print_synchro
Global lock to prevent interleaving of progress display messages.boolean
shouldStop
Clients should set this variable instead of calling Thread.stop(), which is deprecated.-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ProgressDisplay(AbstractGenerator generator, ProgressDisplay.Mode outputMode)
Creates a new ProgressDisplay.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the display; good to do before printing to System.out.void
display(boolean withTime)
Displays the current status.private void
display(String message)
Displays the given message.private void
exitDueToNoSteps()
Exit due to too much time without taking a step.String
message(boolean withTime)
Return the progress message.private boolean
noProgressOutput()
Return true iff no progress output should be displayed.private void
printAllStackTraces()
void
run()
private void
updateLastStepTime()
SetlastStepTime
to when the most recent step completed.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
print_synchro
public static final Object print_synchro
Global lock to prevent interleaving of progress display messages.
-
exit_if_no_steps_after_milliseconds
private static int exit_if_no_steps_after_milliseconds
Give up after this many milliseconds, if the generator has not taken a step. That is, if it has not attempted to generate a new test sequence.
-
outputMode
private final ProgressDisplay.Mode outputMode
The output mode.
-
generator
private AbstractGenerator generator
The test generator.
-
shouldStop
public boolean shouldStop
Clients should set this variable instead of calling Thread.stop(), which is deprecated. Typically a client calls "display()" before setting this.
-
lastStepTime
private long lastStepTime
When the most recent step completed.
-
lastNumSteps
private long lastNumSteps
The step number of the most recent step.
-
-
Constructor Detail
-
ProgressDisplay
public ProgressDisplay(AbstractGenerator generator, ProgressDisplay.Mode outputMode)
Creates a new ProgressDisplay.- Parameters:
generator
- the test generatoroutputMode
- the output mode
-
-
Method Detail
-
message
public String message(boolean withTime)
Return the progress message.- Parameters:
withTime
- whether to include time and memory usage- Returns:
- the progress message
-
exitDueToNoSteps
private void exitDueToNoSteps()
Exit due to too much time without taking a step.
-
printAllStackTraces
private void printAllStackTraces()
-
updateLastStepTime
private void updateLastStepTime()
SetlastStepTime
to when the most recent step completed.
-
noProgressOutput
private boolean noProgressOutput()
Return true iff no progress output should be displayed.- Returns:
- true iff no progress output should be displayed
-
clear
public void clear()
Clear the display; good to do before printing to System.out.
-
display
public void display(boolean withTime)
Displays the current status. Call this if you don't want to wait until the next automatic display.- Parameters:
withTime
- whether to print time and memory usage
-
display
private void display(String message)
Displays the given message.- Parameters:
message
- the message to display
-
-