Package org.springframework.util

Examples of org.springframework.util.StopWatch


        private JCRTemplate jcrTemplate;
        private String testQuery;

        public SearchIteratorResults(String s) {
            testQuery = s;
            stopWatch = new StopWatch("SearchIteratorResultsRunnable");
            jcrTemplate = JCRTemplate.getInstance();
        }
View Full Code Here


            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = createSearchCriteria();
            StopWatch stopWatch = new StopWatch("search");
            stopWatch.start("Starting 1000 searchs");
            for (int j = 0; j < 1000; j++) {
                List<Hit<?>> hits = searchService.search(criteria, context).getResults();
                int i = 0;
                for (Hit<?> hit : hits) {
                    logger.info("[" + j + "][" + (++i) + "]: " + hit.getLink());
                }
            }
            stopWatch.stop();
            logger.info(stopWatch.prettyPrint());
        } catch (Exception ex) {
            logger.warn("Exception during test", ex);
        }
    }
View Full Code Here

    public static void oneTimeTearDown() throws Exception {
    }

    @Test
    public void testDumper() throws IOException {
        StopWatch stopWatch = new StopWatch("testErrorFileDumper");
        stopWatch.start(Thread.currentThread().getName() + " generating error dumps");
        for (int i=0; i < LOOP_COUNT; i++) {
            MockHttpServletRequest request = new MockHttpServletRequest();
            request.setRequestURI("/cms");
            request.setQueryString("name=value");
            request.addHeader("headerName", "headerValue");
            ErrorFileDumper.dumpToFile(new Throwable("mock error " + i), (HttpServletRequest) request);
        }
        stopWatch.stop();
        long totalTime = stopWatch.getTotalTimeMillis();
        double averageTime = ((double) totalTime) / ((double) LOOP_COUNT);
        logger.info("Milliseconds per exception = " + averageTime);
        logger.info(stopWatch.prettyPrint());
    }
View Full Code Here

public class ProfilingInterceptor implements MethodInterceptor {

    public Object invoke(MethodInvocation invocation) throws Throwable {
        long prima = 0;
        long dopo = 0;
        StopWatch sw = new StopWatch();
        prima = System.currentTimeMillis();
        System.out.println("prima" + prima);
        sw.start(invocation.getMethod().getName());

        Object returnValue = invocation.proceed();

        sw.stop();
        dopo = System.currentTimeMillis();
        System.out.println("dopo" + dopo);
        System.out.println("Impiegato :" + (dopo - prima) + " ms");
        dumpInfo(invocation, sw.getTotalTimeMillis());
        return returnValue;
    }
View Full Code Here

            return true;
        }
    }

    void reloadRootModule() {
        StopWatch watch = new StopWatch();
        watch.start();
        Impala.reloadRootModule();
        watch.stop();
        String rootName = Impala.getRootModuleDefinition().getName();
        InteractiveCommandUtils.printReloadInfo(rootName, rootName, watch);
    }
View Full Code Here

        String rootName = Impala.getRootModuleDefinition().getName();
        InteractiveCommandUtils.printReloadInfo(rootName, rootName, watch);
    }
   
    void reloadModule(String moduleToReload, CommandState commandState) {
        StopWatch watch = new StopWatch();
        watch.start();
        String actualModule = null;

        if (!Impala.reloadModule(moduleToReload)) {
            actualModule = Impala.reloadModuleLike(moduleToReload);
        } else {
            actualModule = moduleToReload;
        }
        watch.stop();

        if (moduleToReload != null)
            commandState.addProperty(ACTUAL_MODULE_RELOADED, new CommandPropertyValue(moduleToReload));
        InteractiveCommandUtils.printReloadInfo(moduleToReload, actualModule, watch);
    }
View Full Code Here

        return reload(commandState);
    }

    private boolean reload(CommandState commandState) {
       
        StopWatch watch = new StopWatch();
        watch.start();
        Impala.repairModules();
        watch.stop();
        InteractiveCommandUtils.printExecutionInfo(watch);
        final RootModuleDefinition rootModuleDefinition = Impala.getRootModuleDefinition();
       
        System.out.println("Current module state:");
        System.out.println(rootModuleDefinition.toString());
View Full Code Here

            return true;
        }
    }

    void reloadRootModule() {
        StopWatch watch = new StopWatch();
        watch.start();
        Impala.reloadRootModule();
        watch.stop();
        String rootName = Impala.getRootModuleDefinition().getName();
        InteractiveCommandUtils.printReloadInfo(rootName, rootName, watch);
    }
View Full Code Here

        String rootName = Impala.getRootModuleDefinition().getName();
        InteractiveCommandUtils.printReloadInfo(rootName, rootName, watch);
    }
   
    void reloadModule(String moduleToReload, CommandState commandState) {
        StopWatch watch = new StopWatch();
        watch.start();
        String actualModule = null;

        if (!Impala.reload(moduleToReload)) {
            actualModule = Impala.reloadLike(moduleToReload);
        } else {
            actualModule = moduleToReload;
        }
        watch.stop();

        if (moduleToReload != null)
            commandState.addProperty(ACTUAL_MODULE_RELOADED, new CommandPropertyValue(moduleToReload));
        InteractiveCommandUtils.printReloadInfo(moduleToReload, actualModule, watch);
    }
View Full Code Here

        return reload(commandState);
    }

    private boolean reload(CommandState commandState) {
       
        StopWatch watch = new StopWatch();
        watch.start();
        Impala.repairModules();
        watch.stop();
        InteractiveCommandUtils.printExecutionInfo(watch);
        final RootModuleDefinition rootModuleDefinition = Impala.getRootModuleDefinition();
       
        System.out.println("Current module state:");
        System.out.println(rootModuleDefinition.toString());
View Full Code Here

TOP

Related Classes of org.springframework.util.StopWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.