Legibility improvements to ProgressMeter
- Fields in the header are delimited with the pipe character - Header is now split into two lines to improve spacing - Field width in header and progress lines auto-adjusts to length of "processing units" label (sites, active regions, etc) - Addresses PT 69725930
This commit is contained in:
parent
b77589696e
commit
6122b2805d
|
|
@ -136,6 +136,16 @@ public class ProgressMeter {
|
||||||
*/
|
*/
|
||||||
private final String processingUnitName;
|
private final String processingUnitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The space allocated to #processingUnitName in the output
|
||||||
|
*/
|
||||||
|
private final int processingUnitWidth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The format string used for progress lines
|
||||||
|
*/
|
||||||
|
private final String progressFormatString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A potentially null file where we print a supplementary, R readable performance log
|
* A potentially null file where we print a supplementary, R readable performance log
|
||||||
* file.
|
* file.
|
||||||
|
|
@ -181,6 +191,8 @@ public class ProgressMeter {
|
||||||
|
|
||||||
this.processingUnitName = processingUnitName;
|
this.processingUnitName = processingUnitName;
|
||||||
this.regionsBeingProcessed = processingIntervals;
|
this.regionsBeingProcessed = processingIntervals;
|
||||||
|
this.processingUnitWidth = Math.max(processingUnitName.length(), "processed".length());
|
||||||
|
this.progressFormatString = String.format("%%15s %%%1$ds %%7s %%%1$ds %%5.1f%%%% %%7s %%9s", processingUnitWidth);
|
||||||
|
|
||||||
// setup the performance logger output, if requested
|
// setup the performance logger output, if requested
|
||||||
if ( performanceLogFile != null ) {
|
if ( performanceLogFile != null ) {
|
||||||
|
|
@ -215,10 +227,12 @@ public class ProgressMeter {
|
||||||
public synchronized void start() {
|
public synchronized void start() {
|
||||||
timer.start();
|
timer.start();
|
||||||
lastProgressPrintTime = timer.currentTime();
|
lastProgressPrintTime = timer.currentTime();
|
||||||
|
final String formatString = String.format("%%15s | %%%1$ds | %%7s | %%%1$ds | %%9s | %%7s | %%9s", processingUnitWidth);
|
||||||
|
|
||||||
logger.info("[INITIALIZATION COMPLETE; STARTING PROCESSING]");
|
logger.info("[INITIALIZATION COMPLETE; STARTING PROCESSING]");
|
||||||
logger.info(String.format("%15s processed.%s runtime per.1M.%s completed total.runtime remaining",
|
logger.info(String.format(formatString, "", "processed", "time", "per 1M", "", "total", "remaining"));
|
||||||
"Location", processingUnitName, processingUnitName));
|
logger.info(String.format(formatString, "Location", processingUnitName, "elapsed", processingUnitName,
|
||||||
|
"completed", "runtime", "runtime"));
|
||||||
|
|
||||||
progressMeterDaemon.start();
|
progressMeterDaemon.start();
|
||||||
}
|
}
|
||||||
|
|
@ -362,18 +376,18 @@ public class ProgressMeter {
|
||||||
if ( printProgress || printLog ) {
|
if ( printProgress || printLog ) {
|
||||||
final ProgressMeterData progressData = takeProgressSnapshot(maxGenomeLoc, nTotalRecordsProcessed);
|
final ProgressMeterData progressData = takeProgressSnapshot(maxGenomeLoc, nTotalRecordsProcessed);
|
||||||
|
|
||||||
final AutoFormattingTime elapsed = new AutoFormattingTime(progressData.getElapsedSeconds());
|
final AutoFormattingTime elapsed = new AutoFormattingTime(progressData.getElapsedSeconds(), 5, 1);
|
||||||
final AutoFormattingTime bpRate = new AutoFormattingTime(progressData.secondsPerMillionBP());
|
final AutoFormattingTime bpRate = new AutoFormattingTime(progressData.secondsPerMillionBP());
|
||||||
final AutoFormattingTime unitRate = new AutoFormattingTime(progressData.secondsPerMillionElements());
|
final AutoFormattingTime unitRate = new AutoFormattingTime(progressData.secondsPerMillionElements());
|
||||||
final double fractionGenomeTargetCompleted = progressData.calculateFractionGenomeTargetCompleted(targetSizeInBP);
|
final double fractionGenomeTargetCompleted = progressData.calculateFractionGenomeTargetCompleted(targetSizeInBP);
|
||||||
final AutoFormattingTime estTotalRuntime = new AutoFormattingTime(elapsed.getTimeInSeconds() / fractionGenomeTargetCompleted);
|
final AutoFormattingTime estTotalRuntime = new AutoFormattingTime(elapsed.getTimeInSeconds() / fractionGenomeTargetCompleted, 5, 1);
|
||||||
final AutoFormattingTime timeToCompletion = new AutoFormattingTime(estTotalRuntime.getTimeInSeconds() - elapsed.getTimeInSeconds());
|
final AutoFormattingTime timeToCompletion = new AutoFormattingTime(estTotalRuntime.getTimeInSeconds() - elapsed.getTimeInSeconds());
|
||||||
|
|
||||||
if ( printProgress ) {
|
if ( printProgress ) {
|
||||||
lastProgressPrintTime = curTime;
|
lastProgressPrintTime = curTime;
|
||||||
updateLoggerPrintFrequency(estTotalRuntime.getTimeInSeconds());
|
updateLoggerPrintFrequency(estTotalRuntime.getTimeInSeconds());
|
||||||
|
|
||||||
logger.info(String.format("%15s %5.2e %s %s %5.1f%% %s %s",
|
logger.info(String.format(progressFormatString,
|
||||||
position.getMessage(), progressData.getUnitsProcessed()*1.0, elapsed, unitRate,
|
position.getMessage(), progressData.getUnitsProcessed()*1.0, elapsed, unitRate,
|
||||||
100*fractionGenomeTargetCompleted, estTotalRuntime, timeToCompletion));
|
100*fractionGenomeTargetCompleted, estTotalRuntime, timeToCompletion));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue