public ProgressLogger(Logger log, String label, long tickPoint, int superTick) { super(label, tickPoint, superTick, (fmt, args)->print(log, fmt, args) ) ; }
public ProgressLogger(Logger log, String label, long tickPoint, int superTick) { super(label, tickPoint, superTick, (fmt, args)->print(log, fmt, args) ) ; }
public void startMessage() { print("Start:") ; }
public void finishMessage() { // Elapsed. long timePoint = timer.getTimeInterval() ; // *1000L is milli to second conversion if ( timePoint != 0 ) { long runAvgRate = (counterTotal * 1000L) / timePoint ; print("Finished: %,d %s (Avg: %,d)", counterTotal, label, runAvgRate) ; } else print("Finished: %,d %s (Avg: ----)", counterTotal, label) ; }
private void elapsed(long timerReading) { float elapsedSecs = timerReading/1000F ; print(" Elapsed: %,.2f seconds [%s]", elapsedSecs, nowAsString()) ; }
public void tick() { counterBatch++ ; counterTotal++ ; if ( tickPoint(counterTotal, tickPoint) ) { long timePoint = timer.readTimer() ; long thisTime = timePoint - lastTime ; // *1000L is milli to second conversion if ( thisTime != 0 && timePoint != 0 ) { long batchAvgRate = (counterBatch * 1000L) / thisTime; long runAvgRate = (counterTotal * 1000L) / timePoint ; print("Add: %,d %s (Batch: %,d / Avg: %,d)", counterTotal, label, batchAvgRate, runAvgRate) ; } else { print("Add: %,d %s (Batch: ---- / Avg: ----)", counterTotal, label) ; } lastTime = timePoint ; if ( tickPoint(counterTotal, superTick*tickPoint) ) elapsed(timePoint) ; counterBatch = 0 ; lastTime = timePoint ; } }