Author: andy Date: Tue Oct 22 09:59:51 2013 New Revision: 1534579 URL: http://svn.apache.org/r1534579 Log: Merge two different sets of changes.
Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/ProgressLogger.java Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/ProgressLogger.java URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/ProgressLogger.java?rev=1534579&r1=1534578&r2=1534579&view=diff ============================================================================== --- jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/ProgressLogger.java (original) +++ jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/ProgressLogger.java Tue Oct 22 09:59:51 2013 @@ -46,6 +46,23 @@ public class ProgressLogger this.timer = new Timer() ; } + 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) ; + } + public void start() { timer.startTimer() ; @@ -82,7 +99,6 @@ public class ProgressLogger print("Add: %,d %s (Batch: ---- / Avg: ----)", counterTotal, label) ; } - lastTime = timePoint ; if ( tickPoint(counterTotal, superTick*tickPoint) ) @@ -98,7 +114,8 @@ public class ProgressLogger print(" Elapsed: %,.2f seconds [%s]", elapsedSecs, nowAsString()) ; } - private void print(String fmt, Object...args) + /** Print a message in the form for this ProgressLogger */ + public void print(String fmt, Object...args) { if ( log != null && log.isInfoEnabled() ) { @@ -107,8 +124,6 @@ public class ProgressLogger } } - - static boolean tickPoint(long counter, long quantum) { return counter%quantum == 0 ;