Example usage for org.apache.commons.lang.time StopWatch start

List of usage examples for org.apache.commons.lang.time StopWatch start

Introduction

In this page you can find the example usage for org.apache.commons.lang.time StopWatch start.

Prototype

public void start() 

Source Link

Document

Start the stopwatch.

This method starts a new timing session, clearing any previous values.

Usage

From source file:com.liferay.calendar.messaging.CalendarHotDeployMessageListener.java

protected void onDeploy(Message message) throws Exception {
    if (!PortletPropsValues.CALENDAR_SYNC_CALEVENTS_ON_STARTUP) {
        return;/* ww w .  j a  v  a  2 s.c  o m*/
    }

    StopWatch stopWatch = new StopWatch();

    stopWatch.start();

    CalendarImporterLocalServiceUtil.importCalEvents();

    if (_log.isInfoEnabled()) {
        StringBundler sb = new StringBundler(6);

        sb.append("Calendar events synchronization takes ");
        sb.append(stopWatch.getTime());
        sb.append(" ms. Set the property ");
        sb.append("\"calendar.sync.calevents.on.startup\" ");
        sb.append("to \"false\" to disable calendar events ");
        sb.append("synchronization.");

        _log.info(sb.toString());
    }
}

From source file:de.unisb.cs.st.javalanche.mutation.util.DBPerformanceTest.java

private void queryMutations() {
    List<Long> ids = new ArrayList<Long>();
    for (Mutation m : getMutations()) {
        ids.add(m.getId());/*from  w w w.  j  av a2s.c o  m*/
    }
    StringBuilder sb = new StringBuilder();
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    List<Mutation> mutations = QueryManager.getMutationsByIds(ids.toArray(new Long[0]));
    for (Mutation mutation : mutations) {
        sb.append(mutation.getClassName());
    }
    stopWatch.stop();
    System.out.printf("Querying %d mutations took %s -- checkvalue: %d\n", LIMIT,
            DurationFormatUtils.formatDurationHMS(stopWatch.getTime()), sb.length());
}

From source file:fr.cnrs.sharp.test.MainCLITest.java

@Test
public void Main1() throws IOException {
    InputStream is = MainCLITest.class.getClassLoader().getResourceAsStream("galaxy.prov.ttl");
    Path p = Files.createTempFile("test-prov", ".ttl");
    FileUtils.copyInputStreamToFile(is, p.toFile());
    System.out.println("Galaxy PROV written to " + p.toString());

    String[] params = { "-i", p.toString() };

    StopWatch sw = new StopWatch();
    sw.start();
    Main.main(params);/*from  ww w.  ja  va  2s . c  o m*/
    sw.stop();
    System.out.println("DONE in " + sw.getTime() + " ms");

}

From source file:fr.cnrs.sharp.test.MainCLITest.java

@Test
public void Main2() throws IOException {
    InputStream is = MainCLITest.class.getClassLoader().getResourceAsStream("galaxy.prov.ttl");
    Path p = Files.createTempFile("test-prov", ".ttl");
    FileUtils.copyInputStreamToFile(is, p.toFile());
    System.out.println("Galaxy PROV written to " + p.toString());

    String[] params = { "-i", p.toString(), "-s" };

    StopWatch sw = new StopWatch();
    sw.start();
    Main.main(params);//from  w  w  w  . java  2  s. c  om
    sw.stop();
    System.out.println("DONE in " + sw.getTime() + " ms");

}

From source file:de.rinderle.softvis3d.VisualizationProcessor.java

public Map<Integer, ResultPlatform> visualize(final Settings settings, final VisualizationRequest requestDTO,
        final SnapshotTreeResult snapshotTreeResult) throws DotExecutorException {

    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    final Map<Integer, ResultPlatform> resultGraphs = layoutProcessor.process(settings, requestDTO,
            snapshotTreeResult);/*from w w w  . j  av a  2  s. c o  m*/

    LOGGER.info("Created " + resultGraphs.size() + " result graphs in " + stopWatch.getTime() + " ms");

    final int leavesCounter = this.calc.process(requestDTO.getViewType(), resultGraphs, snapshotTreeResult);

    stopWatch.stop();
    LOGGER.info("Calculation finished after " + stopWatch.getTime() + " ms with " + leavesCounter + " leaves");

    return resultGraphs;
}

From source file:de.unisb.cs.st.javalanche.mutation.hibernate.CoverageDataTest.java

public void testHugeCoverageDataSerialize() {
    Map<Long, Set<String>> map = getCoverageData();
    StopWatch stp = new StopWatch();
    stp.start();
    SerializeIo.serializeToFile(map, new File("/Users/schuler/test.ser"));
    stp.stop();/*from   w ww.  j  a  v  a2 s.  c om*/
    System.out.println("TIME " + stp.getTime());
}

From source file:de.rinderle.softvis3d.dao.DaoService.java

public List<SonarMeasure> getFlatChildrenWithMetrics(final LocalConnector localConnector,
        final VisualizationRequest requestDTO) {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    final Set<String> metrics = new HashSet<>();
    metrics.add(requestDTO.getFootprintMetricKey());
    metrics.add(requestDTO.getHeightMetricKey());

    if (ColorMetricType.DEFAULT_METRIC.equals(requestDTO.getColorMetricType())) {
        metrics.add(requestDTO.getColorMetricType().getDefaultMetricName());
    }/*from ww w  .  ja  v  a  2  s  . c om*/

    final List<WsMeasures.Component> resultComponents = sonarDao
            .getAllSnapshotIdsWithRescourceId(localConnector, requestDTO.getRootSnapshotKey(), metrics);

    return daoServiceTransformer.transformComponentToMeasure(resultComponents, requestDTO);
}

From source file:com.icantrap.collections.dawg.DawgValidationTest.java

@Test
public void containsAllWords() throws IOException {
    LineIterator iter = IOUtils.lineIterator(getClass().getResourceAsStream("/TWL06.txt"), null);

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    while (iter.hasNext()) {
        String word = iter.next();
        assertTrue("Missing word (" + word + ")", dawg.contains(word));
    }//from  w ww .j  a v  a 2 s. co m

    stopWatch.stop();
    System.out.println("Time to query:  " + stopWatch.getTime() + " ms.");

    LineIterator.closeQuietly(iter);
}

From source file:com.redhat.rhn.taskomatic.task.test.ErrataCacheTaskTest.java

public void aTestExecute() throws Exception {
    StopWatch sw = new StopWatch();

    ErrataCacheTask ect = new ErrataCacheTask();

    sw.start();
    ect.execute(null);/*from   www. j a v a2 s. c om*/
    sw.stop();
    System.out.println("ErrataCacheTask took [" + sw.getTime() + "]");
}

From source file:de.unisb.cs.st.javalanche.mutation.hibernate.CoverageDataTest.java

@Test
public void testHugeCoverageDataSerialize2() {
    Map<Long, Set<String>> map = getCoverageData();
    StopWatch stp = new StopWatch();
    stp.start();
    MutationCoverageFile.saveCoverageData(map);
    stp.stop();/*from  ww w  .  ja  v a2s  .  c  o  m*/
    System.out.println("Saving coverage data took:" + stp.getTime());
    MutationCoverageFile.reset();
    Mutation m = new Mutation("dummy", "dummy", 1, 1, MutationType.ARITHMETIC_REPLACE);
    m.setId(10l);
    Set<String> coverageData = MutationCoverageFile.getCoverageData(m);
    Set<String> tests = getTests();
    assertEquals(tests.size(), coverageData.size());
    for (String test : coverageData) {
        assertTrue(tests.contains((test)));
    }

}