org.apache.commons.lang3.time.StopWatch.toString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.apache.commons.lang3.time.StopWatch.toString()方法的一些代码示例,展示了StopWatch.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StopWatch.toString()方法的具体详情如下:
包路径:org.apache.commons.lang3.time.StopWatch
类名称:StopWatch
方法名:toString

StopWatch.toString介绍

[英]Gets a summary of the time that the stopwatch recorded as a string.

The format used is ISO 8601-like, hours:minutes:seconds.milliseconds.
[中]获取秒表记录为字符串的时间摘要。
使用的格式类似于ISO 8601,小时:分钟:秒。毫秒。

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

@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);
}

代码示例来源:origin: com.norconex.collectors/norconex-committer-core

@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());
  }
}

代码示例来源:origin: com.norconex.collectors/norconex-committer-core

@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());
  }
}

代码示例来源:origin: com.norconex.collectors/norconex-committer-core

@Override
public void commit() {
  LOG.info(addCount + " additions committed.");
  LOG.info(removeCount + " deletions committed.");
  LOG.info("Total elapsed time: " + watch.toString());
}

代码示例来源:origin: ru.vyarus/dropwizard-guicey

@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");
}

代码示例来源:origin: xvik/dropwizard-guicey

@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");
}

代码示例来源:origin: org.patterntesting/patterntesting-rt

/**
 * 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);
}

代码示例来源:origin: de.aosd.clazzfish/clazzfish-monitor

/**
 * 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);
}

代码示例来源:origin: mopemope/meghanada-server

writer.write("elapsed: " + stopWatch.toString());
 writer.newLine();
} catch (Throwable t) {

代码示例来源:origin: com.foreach.cwb/cwb-core

System.out.println( "HTML reports generated [" + sw.toString() + "]" );

代码示例来源:origin: cheng-li/pyramid

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());

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

/**
 * 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;
}

代码示例来源:origin: cheng-li/pyramid

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());
}

代码示例来源:origin: org.onehippo.cms/hippo-configuration-management-model

/**
 * 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;
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

forceApply ? "fully " : "",
      verify ? "and verified " : "",
      stopWatch.toString());
  return true;
} catch (Exception e) {

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

log.info("Completed full auto-export merge in {}", stopWatch.toString());

代码示例来源:origin: org.deeplearning4j/cdh4

this.multiLayerNetwork.fit( hdfs_recordBatch );
batchWatch.stop();
log.info("Worker > Processed Total " + this.totalRecordsProcessed + ", Batch Time " + batchWatch.toString() + " Total Time " + totalRunTimeWatch.toString());

代码示例来源:origin: locationtech/geowave

LOGGER.debug(results + " results remaining after delete; time = " + stopWatch.toString());

代码示例来源:origin: locationtech/geowave

runQuery(adapter, typeName, indexName, dataStore, debug, storeOptions.getDataStorePlugin());
stopWatch.stop();
System.out.println("Got " + results + " results in " + stopWatch.toString());

代码示例来源:origin: locationtech/geowave

System.out.println("Ran BBOX query in " + stopWatch.toString());
System.out.println("BBOX query results iteration took " + stopWatch.toString());

相关文章