@Test public void testStopWatchSimpleGet() { final StopWatch watch = new StopWatch(); assertEquals(0, watch.getTime()); assertEquals("00:00:00.000", watch.toString()); watch.start(); try { Thread.sleep(500); } catch (final InterruptedException ex) { } assertTrue(watch.getTime() < 2000); }
@Override public synchronized void add( String reference, InputStream content, Properties metadata) { addCount++; if (LOG.isDebugEnabled()) { LOG.debug("Queing addition of " + reference); } if (addCount % LOG_TIME_BATCH_SIZE == 0) { LOG.info(addCount + " additions queued in: " + watch.toString()); } }
@Override public synchronized void remove(String reference, Properties metadata) { removeCount++; if (LOG.isDebugEnabled()) { LOG.debug("Queing deletion of " + reference); } if (removeCount % LOG_TIME_BATCH_SIZE == 0) { LOG.info(removeCount + " deletions queued in " + watch.toString()); } }
@Override public void commit() { LOG.info(addCount + " additions committed."); LOG.info(removeCount + " deletions committed."); LOG.info("Total elapsed time: " + watch.toString()); }
@SuppressWarnings("PMD.SystemPrintln") private void log(final String message, final Object... args) { final int gap = 70; final String time = timer.toString(); final String msg = String.format(message, args); final String topLine = String.format("%" + (gap + 3) + "s", "") + String.join("", Collections.nCopies(msg.length(), "\u2500")); final String prefix = "__[ " + time + " ]" + String.join("", Collections.nCopies((gap - 6) - time.length(), "_")); System.out.println("\n\n" + topLine + NL + prefix + "/ " + msg + " \\____\n"); }
@SuppressWarnings("PMD.SystemPrintln") private void log(final String message, final Object... args) { final int gap = 70; final String time = timer.toString(); final String msg = String.format(message, args); final String topLine = String.format("%" + (gap + 3) + "s", "") + String.join("", Collections.nCopies(msg.length(), "\u2500")); final String prefix = "__[ " + time + " ]" + String.join("", Collections.nCopies((gap - 6) - time.length(), "_")); System.out.println("\n\n" + topLine + NL + prefix + "/ " + msg + " \\____\n"); }
/** * To string. * * @return the string * @see Object#toString() */ @Override public String toString() { double millis = this.getTimeInMillis(); if (millis > 6000000.0) { return super.toString(); } return Converter.getTimeAsString(millis, Locale.ENGLISH); }
/** * To string. * * @return the string * @see Object#toString() */ @Override public String toString() { double millis = this.getTimeInMillis(); if (millis > 6000000.0) { return super.toString(); } return getTimeAsString(millis, Locale.ENGLISH); }
writer.write("elapsed: " + stopWatch.toString()); writer.newLine(); } catch (Throwable t) {
System.out.println( "HTML reports generated [" + sw.toString() + "]" );
cbm.binaryClassifiers[component][label] = new PriorProbClassifier(probs); sb.append(", skip, use prior = ").append(smoothedPositiveProb); sb.append(", time spent = ").append(stopWatch.toString()); if (logger.isDebugEnabled()){ logger.debug(sb.toString());
/** * Create a new ConfigurationModel with the updated definitions in the toExport modules. * @param baseline the existing model upon which we'll base the new one * @return the new ConfigurationModel, which references Sources from the old Modules in baseline and toExport */ protected ConfigurationModelImpl rebuild(final ConfigurationModelImpl baseline) { final StopWatch stopWatch = new StopWatch(); stopWatch.start(); // note: we assume that the original baseline will perform any required cleanup in close(), so we don't need // to copy FileSystems etc. here final ConfigurationModelImpl model = new ConfigurationModelImpl(); toExport.values().forEach(model::addModule); baseline.getSortedGroups().forEach(model::addGroup); model.build(); stopWatch.stop(); log.debug("Model rebuilt for auto-export merge in {}", stopWatch.toString()); return model; }
private void updateBinaryLogisticRegression(int componentIndex, int labelIndex){ StopWatch stopWatch = new StopWatch(); stopWatch.start(); double effectivePositives = effectivePositives(componentIndex, labelIndex); StringBuilder sb = new StringBuilder(); sb.append("for component ").append(componentIndex).append(", label ").append(labelIndex); sb.append(", effective positives = ").append(effectivePositives); if (effectivePositives<=1){ double positiveProb = prior(componentIndex, labelIndex); double[] probs = {1-positiveProb, positiveProb}; cbm.binaryClassifiers[componentIndex][labelIndex] = new PriorProbClassifier(probs); sb.append(", skip, use prior = ").append(positiveProb); sb.append(", time spent = "+stopWatch.toString()); System.out.println(sb.toString()); return; } if (cbm.binaryClassifiers[componentIndex][labelIndex]==null || cbm.binaryClassifiers[componentIndex][labelIndex] instanceof PriorProbClassifier){ cbm.binaryClassifiers[componentIndex][labelIndex] = new LogisticRegression(2, dataSet.getNumFeatures()); } RidgeLogisticOptimizer ridgeLogisticOptimizer; int[] binaryLabels = DataSetUtil.toBinaryLabels(dataSet.getMultiLabels(), labelIndex); // no parallelism ridgeLogisticOptimizer = new RidgeLogisticOptimizer((LogisticRegression)cbm.binaryClassifiers[componentIndex][labelIndex], dataSet, binaryLabels, activeGammas, priorVarianceBinary, false); //TODO maximum iterations ridgeLogisticOptimizer.getOptimizer().getTerminator().setMaxIteration(numBinaryUpdates); ridgeLogisticOptimizer.optimize(); sb.append(", time spent = "+stopWatch.toString()); System.out.println(sb.toString()); }
/** * Searches the classpath for module manifest files and uses these as entry points for loading HCM module * configuration and content into a ConfigurationModel. * * @param classLoader the ClassLoader which will be searched for HCM modules * @param verifyOnly when true use 'verify only' yaml parsing, allowing (but warning on) certain model errors * @return a ConfigurationModel of configuration and content definitions * @throws IOException * @throws ParserException */ public ConfigurationModelImpl read(final ClassLoader classLoader, final boolean verifyOnly) throws IOException, ParserException, URISyntaxException { final StopWatch stopWatch = new StopWatch(); stopWatch.start(); final ConfigurationModelImpl model = new ConfigurationModelImpl(); // load modules that are packaged on the classpath final Pair<Set<FileSystem>, List<GroupImpl>> classpathGroups = readModulesFromClasspath(classLoader, verifyOnly); // add classpath modules to model classpathGroups.getRight().forEach(model::addGroup); // add filesystems to the model model.setFileSystems(classpathGroups.getLeft()); // build the merged model model.build(); stopWatch.stop(); log.info("ConfigurationModel loaded in {}", stopWatch.toString()); return model; }
forceApply ? "fully " : "", verify ? "and verified " : "", stopWatch.toString()); return true; } catch (Exception e) {
log.info("Completed full auto-export merge in {}", stopWatch.toString());
LOGGER.debug(results + " results remaining after delete; time = " + stopWatch.toString());
runQuery(adapter, typeName, indexName, dataStore, debug, storeOptions.getDataStorePlugin()); stopWatch.stop(); System.out.println("Got " + results + " results in " + stopWatch.toString());