List of usage examples for org.apache.commons.lang.time StopWatch stop
public void stop()
Stop the stopwatch.
This method ends a new timing session, allowing the time to be retrieved.
From source file:ch.systemsx.cisd.openbis.generic.server.authorization.DefaultAccessController.java
private final static void logTimeTaken(final StopWatch stopWatch, final Method method) { stopWatch.stop(); if (operationLog.isDebugEnabled()) { operationLog.debug(String.format("Controlling access to method '%s' took %s", MethodUtils.describeMethod(method), stopWatch)); }/* w w w .j a v a 2 s. c o m*/ }
From source file:com.icantrap.collections.dawg.DawgValidationTest.java
@BeforeClass public static void init() throws IOException { assumeThat(System.getProperty("RUN_VALIDATION"), is("on")); StopWatch stopWatch = new StopWatch(); stopWatch.start();/* w w w . jav a 2 s .c o m*/ dawg = Dawg.load(DawgValidationTest.class.getResourceAsStream("/twl06.dat")); stopWatch.stop(); System.out.println("Time to load " + dawg.nodeCount() + " node dawg: " + stopWatch.getTime() + " ms."); }
From source file:com.cedarsoft.serialization.SplittingPerformanceRunner.java
private static void run(@Nonnull String description, @Nonnull Callable<String> callable) throws Exception { //Warmup//from www.j ava 2s . c o m for (int i = 0; i < 1000; i++) { assertEquals("1.0.0", callable.call()); } //Do the work StopWatch stopWatch = new StopWatch(); stopWatch.start(); for (int i = 0; i < 100000; i++) { assertEquals("1.0.0", callable.call()); } stopWatch.stop(); System.out.println(description + " took " + stopWatch.getTime()); }
From source file:ch.systemsx.cisd.openbis.generic.server.authorization.DefaultReturnValueFilter.java
private final static void logTimeTaken(final StopWatch stopWatch, final Method method) { stopWatch.stop(); if (operationLog.isDebugEnabled()) { operationLog.debug(String.format("Return value filtering of method '%s' took %s", MethodUtils.describeMethod(method), stopWatch)); }//from w w w. java 2 s . c o m }
From source file:com.xiaofengmetis.benchmark.BenchmarkUtils.java
public static Pair<Long, Integer> execute(Benchmark benchmark, int times) { StopWatch stopWatch = new StopWatch(); try {//from w w w. j a va 2 s .c om benchmark.setup(); stopWatch.start(); for (int t = 0; t < times; t++) { benchmark.execute(); } stopWatch.stop(); benchmark.cleanup(); } catch (Exception ex) { throw new RuntimeException(ex); } return Pair.of(stopWatch.getTime(), times); }
From source file:com.qualogy.qafe.core.application.ApplicationContextLoader.java
public synchronized static void load(URI applicationFilePath, boolean validating) { logger.info("start application loading according to config file: [" + applicationFilePath + "]"); StopWatch watch = new StopWatch(); watch.start();/*from w w w .ja v a 2 s.c o m*/ ApplicationStack contexts = read(applicationFilePath, validating); load(contexts, applicationFilePath); watch.stop(); logger.info("done loading from [" + applicationFilePath + "] in " + watch.getTime() + "ms"); ApplicationCluster.getInstance().putAll(contexts); }
From source file:de.unisb.cs.st.javalanche.rhino.coverage.CoberturaParser.java
private static CoverageData parseFile(File file) { StopWatch sw = new StopWatch(); sw.start();//from w w w . ja va 2 s . c om CoberturaHandler handler = new CoberturaHandler(); // Parse the file using the handler parseXmlFile(file, handler, false); CoverageData coverageData = handler.getCoverageData(); sw.stop(); logger.info("Parser took: " + DurationFormatUtils.formatDurationHMS(sw.getTime())); return coverageData; }
From source file:de.unisb.cs.st.javalanche.mutation.util.DBPerformanceTest.java
private static void testWrite() { StopWatch stopWatch = new StopWatch(); stopWatch.start();/*from www . j a va2s. c o m*/ try { File file = new File("test.txt"); file.deleteOnExit(); FileWriter fw = new FileWriter(file); BufferedWriter w = new BufferedWriter(fw); for (int i = 0; i < 50 * 1024 * 1024; i++) { w.append('x'); } w.close(); } catch (IOException e) { e.printStackTrace(); } stopWatch.stop(); System.out.printf("Writing file took %s\n", DurationFormatUtils.formatDurationHMS(stopWatch.getTime())); }
From source file:com.liferay.jira.metrics.util.JiraETLUtil.java
public static void load() { Date now = new Date(); try {/*from www . ja v a2 s.c o m*/ JiraDataRetrieve jiraDataRetrieve = JiraDataRetrieveLocalServiceUtil.fetchByDate(now); if ((jiraDataRetrieve != null) && (STATUS_OK.equals(jiraDataRetrieve.getStatus()) || STATUS_RUNNING.equals(jiraDataRetrieve.getStatus()))) { if (_log.isInfoEnabled() && STATUS_RUNNING.equals(jiraDataRetrieve.getStatus())) { _log.info("The process is running now"); } else if (_log.isInfoEnabled()) { _log.info( "Data from Jira has been loaded sucessfully in " + jiraDataRetrieve.getModifiedDate()); } return; } JiraDataRetrieveLocalServiceUtil.addJiraDataRetrieve(STATUS_RUNNING, null, now); StopWatch stopWatch = new StopWatch(); stopWatch.start(); _loadProjectsFromJira(); _loadStatusesFromJira(); _loadPrioritiesFromJira(); _loadIssueMetricsFromJira(); stopWatch.stop(); JiraDataRetrieveLocalServiceUtil.addJiraDataRetrieve(STATUS_OK, null, now); if (_log.isInfoEnabled()) { _log.info( "Data from Jira has been loaded sucessfully in " + stopWatch.getTime() + " milliseconds."); } } catch (Exception e) { try { JiraDataRetrieveLocalServiceUtil.addJiraDataRetrieve(STATUS_FAILED, e.getMessage(), now); } catch (Exception e1) { _log.error("Exception when trying to persist an error" + e.getMessage(), e); } _log.error("Exception " + e.getMessage(), e); } }
From source file:com.redhat.rhn.frontend.action.LoginHelper.java
/** * @param orgIn/*from w ww . java 2 s .c o m*/ */ private static void publishUpdateErrataCacheEvent(Org orgIn) { StopWatch sw = new StopWatch(); if (log.isDebugEnabled()) { log.debug("Updating errata cache"); sw.start(); } UpdateErrataCacheEvent uece = new UpdateErrataCacheEvent(UpdateErrataCacheEvent.TYPE_ORG); uece.setOrgId(orgIn.getId()); MessageQueue.publish(uece); if (log.isDebugEnabled()) { sw.stop(); log.debug("Finished Updating errata cache. Took [" + sw.getTime() + "]"); } }