@Override public void send(X item) { oneItem() ; }
protected void oneItem() { totalCount ++ ; if ( totalCount != 0 && (totalCount % batchInterval == 0) ) { tickCount ++ ; if ( showProgress ) oneTickDisplay() ; } }
@Override public void close() { printAtEnd() ; }
private void printAtEnd() { long timeMilli = timer.getTimeInterval() ; String x = String.format("%,d %s: loaded in %,.2f seconds [%,.2f %s/s]", totalCount, units, timeMilli/1000.0F, 1000F*totalCount/timeMilli, units) ; println(summaryLabel, x) ; }
public void startMonitor() { resetTimer() ; }
protected void oneTickDisplay() { long soFar = timer.readTimer() ; long thisTime = soFar - lastTime ; // *1000L is milli to second conversion // addNotePoint/ (thisTime/1000L) long tpsBatch = (batchInterval * 1000L) / thisTime; long tpsAvg = (totalCount * 1000L) / soFar; String msg = String.format(format, totalCount, units, tpsBatch, tpsAvg) ; //String msg = "Add: "+StringUtils.str(totalCount)+" triples (Batch: "+StringUtils.str(tpsBatch)+" / Run: "+num(tpsAvg)+")" ; if ( displayMemory ) { long mem = Runtime.getRuntime().totalMemory() ; long free = Runtime.getRuntime().freeMemory() ; msg = msg+String.format(" [M:%,d/F:%,d]", mem, free) ; } println(label, msg) ; if ( tickCount > 0 && (tickCount%10) == 0 ) { String timestamp = StringUtils.str(new Date()) ; String msg2 = String.format(" Elapsed: %f.2f seconds [%s]", soFar/1000F, timestamp) ; println(label, msg2) ; } lastTime = soFar ; }