Example usage for com.google.common.base Stopwatch stop

List of usage examples for com.google.common.base Stopwatch stop

Introduction

In this page you can find the example usage for com.google.common.base Stopwatch stop.

Prototype

public Stopwatch stop() 

Source Link

Document

Stops the stopwatch.

Usage

From source file:qa.qcri.nadeef.core.pipeline.UpdateExecutor.java

public void run() {
    Stopwatch sw = Stopwatch.createStarted();
    updateFlow.reset();//w  ww. j  a v a  2 s  .c om
    updateFlow.start();
    updateFlow.waitUntilFinish();

    PerfReport.appendMetric(PerfReport.Metric.EQTime, sw.elapsed(TimeUnit.MILLISECONDS));
    sw.stop();
}

From source file:org.apache.brooklyn.launcher.osgi.OsgiLauncherImpl.java

@Override
public void startOsgi() {
    synchronized (reloadLock) {
        final Stopwatch startupTimer = Stopwatch.createStarted();
        LOG.debug("OsgiLauncher start");
        startPartTwo();//  w w  w. j a  v a2 s . com
        startupTimer.stop();
        LOG.info("Brooklyn initialisation (part two) complete after {}", startupTimer.toString());
    }
}

From source file:joshelser.LimitAndSumColumnFamilyIterator.java

private void setReturnValue(Stopwatch aggrSw) {
    aggrSw.stop();
    log.trace("Aggregate duration: " + aggrSw.elapsed(TimeUnit.MILLISECONDS));
    if (null != sum) {
        log.debug("Computed a sum of " + sum);
        topValue = new Value(encoder.encode(sum));
    } else {/*from   ww w  . j  av  a  2s  .  c o m*/
        topValue = new Value(encoder.encode(0l));
    }
}

From source file:jobs.ComputeNCITdistribution.java

@Override
public void doJob() throws Exception {

    Logger.info("Job started...");
    Stopwatch stopwatch = Stopwatch.createUnstarted();
    stopwatch.start();//from  ww  w. j av a  2  s .com

    List<MorphiaOntologyTerm> terms = MorphiaOntologyTerm.findAll();

    int total = terms.size();
    int counter = 0;
    Directory directory = FSDirectory.open(VirtualFile.fromRelativePath("/indexes/index-2013").getRealFile());
    DirectoryReader ireader = DirectoryReader.open(directory);

    //Just chunck the words - no stop word removal - such concept will not give any result in principle
    Analyzer analyzer = new CustomStopWordsStandardAnalyzer(Version.LUCENE_47);
    IndexSearcher isearcher = new IndexSearcher(ireader);
    QueryParser parser = new QueryParser(Version.LUCENE_47, "contents", analyzer);

    for (MorphiaOntologyTerm ontologyTerm : terms) {
        counter++;

        Logger.info("i: " + counter + "/" + total);
        Stopwatch timeQuery = Stopwatch.createUnstarted();
        timeQuery.start();
        Query query = parser.parse("\"" + ontologyTerm.value + "\"");
        ScoreDoc[] hits = isearcher.search(query, null, 100000000).scoreDocs;
        timeQuery.stop();
        Logger.info("Query time: " + timeQuery.elapsed(TimeUnit.MILLISECONDS));

        Stopwatch timeUpdate = Stopwatch.createUnstarted();
        timeUpdate.start();
        ontologyTerm.frequency = hits.length;
        ontologyTerm.save();
        timeUpdate.stop();
        Logger.info("Update time: " + timeUpdate.elapsed(TimeUnit.MILLISECONDS));
        Logger.info("Query: " + ontologyTerm.value + " - " + hits.length);
    }

    stopwatch.stop();
    Utils.emailAdmin("Distribution completed",
            "Job finished in " + stopwatch.elapsed(TimeUnit.MINUTES) + " minutes.");
    Logger.info("Job finished");

}

From source file:com.tkmtwo.sarapi.ArsTemplate.java

public <T> T execute(ARServerUserCallback<T> action, String description) throws DataAccessException {

    Stopwatch sw = Stopwatch.createStarted();
    T result = execute(action);/*  w  w w.java2 s  .  c  om*/
    sw.stop();

    logger.trace("Executed callback {} in {}", description, sw.toString());
    return result;
}

From source file:org.n52.iceland.service.Service.java

private void logResponse(HttpServletRequest request, HttpServletResponse response, long count,
        Stopwatch stopwatch) {
    long elapsed = stopwatch.stop().elapsed(TimeUnit.MILLISECONDS);
    this.serviceEventBus.submit(new OutgoingResponseEvent(request, response, count, elapsed));
    LOGGER.debug("Outgoing response for request No. {} is committed = {} (took {} ms)", count,
            response.isCommitted(), elapsed);
}

From source file:io.druid.segment.LoggingProgressIndicator.java

@Override
public void stopSection(String section) {
    Stopwatch sectionWatch = sections.remove(section);
    if (sectionWatch == null) {
        throw new ISE("[%s]: Cannot stop progress tracker for [%s]. Nothing started.", progressName, section);
    }/*from  www. j av a2 s. co  m*/
    long time = sectionWatch.elapsed(TimeUnit.MILLISECONDS);
    sectionWatch.stop();

    log.info("[%s]: [%s] has completed. Elapsed time: [%,d] millis", progressName, section, time);
}

From source file:nl.knaw.huygens.timbuctoo.storage.graph.tinkerpop.TinkerPopIterator.java

@Override
public List<T> getSome(int limit) {
    Stopwatch stopwatch = Stopwatch.createStarted();
    LOG.debug("Get some started");
    List<T> some = Lists.newArrayList();
    for (; limit > 0 && hasNext(); limit--) {
        some.add(next());//from   w w  w  . ja v  a2 s.  co m
    }
    LOG.debug("Get some ended in [{}]", stopwatch.stop());

    return some;
}

From source file:es.usc.citius.composit.core.matcher.graph.HashMatchGraph.java

public HashMatchGraph(SetMatchFunction<E, T> setMatcher, Set<E> elements) {
    Stopwatch w = Stopwatch.createStarted();
    logger.debug("Processing full match of {} elements...", elements.size());
    this.matchTable = setMatcher.fullMatch(elements, elements);
    this.elements = elements;
    logger.debug("Match processing finished in {}.", w.stop().toString());
}

From source file:com.palantir.atlasdb.keyvalue.cassandra.jmx.CassandraJmxCompactionClient.java

private boolean tryTableCompactionInternal(String keyspace, String tableName) {
    try {/*www  . j a  va  2s. c  om*/
        Stopwatch stopWatch = Stopwatch.createStarted();
        storageServiceProxy.forceKeyspaceCompaction(true, keyspace, tableName);
        log.info("Compaction for {}.{} completed in {}", keyspace, tableName, stopWatch.stop());
    } catch (Exception e) {
        log.error("Failed to compaction {}.{}.", keyspace, tableName, e);
        Throwables.propagateIfPossible(e);
        return false;
    }
    return true;
}