Package org.springframework.util

Examples of org.springframework.util.StopWatch


    @Test
    public void testConcurrentReadWrite10PercentUnstructured() throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newFixedThreadPool(300);
        ExecutorCompletionService<Boolean> service = new ExecutorCompletionService<Boolean>(executor);
        StopWatch stopWatch = new StopWatch("testConcurrentReadWrite10PercentUnstructured");
        stopWatch.start(Thread.currentThread().getName() + " reading // writing nodes (10% writers)");
        for (int i = 0; i < 1000; i++) {
            if (i % 10 == 0) {
                service.submit(new Writer("nt:unstructured"), Boolean.TRUE);
            } else {
                service.submit(new Reader(), Boolean.TRUE);
            }
        }
        for (int i = 0; i < 1000; i++) {
            Boolean aBoolean = service.take().get();
        }
        stopWatch.stop();
        logger.error(stopWatch.prettyPrint());
        executor.shutdown();
    }
View Full Code Here


        Logger metricsLogger = Logger.getLogger("loggingService");
        Logger profilerMetricsLogger = Logger.getLogger("profilerLoggingService");
        profilerMetricsLogger.setLevel(Level.OFF);
       
        metricsLogger.setLevel(Level.OFF);
        StopWatch stopWatch = new StopWatch();
        stopWatch.start("Create " + TAGS_TO_CREATE + " without logs");
        for (int i = 0; i < TAGS_TO_CREATE; i++) {
            service.createTag(generateTagName(), TESTSITE_NAME);
        }
        stopWatch.stop();
        final long withoutLogs = stopWatch.getLastTaskTimeMillis();
       
        deleteAllTags();
       
        for (int i = 0; i < 3; i++) {
            service.createTag(generateTagName(), TESTSITE_NAME);
        }
       
        metricsLogger.setLevel(Level.TRACE);
        stopWatch.start("Create " + TAGS_TO_CREATE + " with logs");
        for (int i = 0; i < TAGS_TO_CREATE; i++) {
            service.createTag(generateTagName(), TESTSITE_NAME);
        }
        stopWatch.stop();
        final long withLogs = stopWatch.getLastTaskTimeMillis();
       
        logger.info(stopWatch.prettyPrint());
       
        if (withLogs > withoutLogs) {
            assertThat("Logs has more than 5% impact on peformance",
                    ((Math.abs(withLogs - withoutLogs) / (float)withoutLogs) * 100), (Matcher<Object>) lessThan((float)5));
        }
View Full Code Here

    @Test
    public void testConcurrentSearchIsDescendant() throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newFixedThreadPool(300);
        ExecutorCompletionService<Boolean> service = new ExecutorCompletionService<Boolean>(executor);
        StopWatch stopWatch = new StopWatch("testConcurrentSearchIsDescendant");
        stopWatch.start(Thread.currentThread().getName() + " search jnt:pages nodes is descendant site node");
        for (int i = 0; i < 1000; i++) {
            service.submit(new Search("select * from [jnt:page] as page where isdescendantnode(page, 'path') "), Boolean.TRUE);
        }
        for (int i = 0; i < 1000; i++) {
            Boolean aBoolean = service.take().get();
        }
        stopWatch.stop();
        logger.error(stopWatch.prettyPrint());
        executor.shutdown();
    }
View Full Code Here

    @Test
    public void testConcurrentSearchIsChild() throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newFixedThreadPool(300);
        ExecutorCompletionService<Boolean> service = new ExecutorCompletionService<Boolean>(executor);
        StopWatch stopWatch = new StopWatch("testConcurrentSearchIsChild");
        stopWatch.start(Thread.currentThread().getName() + " search jnt:pages nodes is child site node");
        for (int i = 0; i < 1000; i++) {
            service.submit(new Search("select * from [jnt:page] as page where ischildnode(page, 'path') "), Boolean.TRUE);
        }
        for (int i = 0; i < 1000; i++) {
            Boolean aBoolean = service.take().get();
        }
        stopWatch.stop();
        logger.error(stopWatch.prettyPrint());
        executor.shutdown();
    }
View Full Code Here

    @Test
    public void testConcurrentSearchIsDescendantAndIteratorResults() throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newFixedThreadPool(300);
        ExecutorCompletionService<Boolean> service = new ExecutorCompletionService<Boolean>(executor);
        StopWatch stopWatch = new StopWatch("testConcurrentSearchIsDescendantAndIteratorResults");
        stopWatch.start(Thread.currentThread().getName() + " search jnt:page nodes is descendant site node, iterator results for query results size = -1 ");
        for (int i = 0; i < 1000; i++) {
            service.submit(new SearchIteratorResults("select * from [jnt:page] as page where isdescendantnode(page, 'path') "), Boolean.TRUE);
        }
        for (int i = 0; i < 1000; i++) {
            Boolean aBoolean = service.take().get();
        }
        stopWatch.stop();
        logger.error(stopWatch.prettyPrint());
        executor.shutdown();
    }
View Full Code Here

    @Test
    public void testConcurrentSearchIsCreatedBeforeNow() throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newFixedThreadPool(300);
        ExecutorCompletionService<Boolean> service = new ExecutorCompletionService<Boolean>(executor);
        StopWatch stopWatch = new StopWatch("testConcurrentSearchIsCreatedBeforeNow");
        stopWatch.start(Thread.currentThread().getName() + " search jnt:page nodes is created before now");
        for (int i = 0; i < 1000; i++) {
            service.submit(new Search("select * from [jnt:page] as page where page.[jcr:created] < CAST(" + System.currentTimeMillis() + " as date) "), Boolean.TRUE);
        }
        for (int i = 0; i < 1000; i++) {
            Boolean aBoolean = service.take().get();
        }
        stopWatch.stop();
        logger.error(stopWatch.prettyPrint());
        executor.shutdown();
    }
View Full Code Here

    @Test
    public void testConcurrentSearchIsCreatedBeforeNowAndIsDescendant() throws InterruptedException, ExecutionException {
        ExecutorService executor = Executors.newFixedThreadPool(300);
        ExecutorCompletionService<Boolean> service = new ExecutorCompletionService<Boolean>(executor);
        StopWatch stopWatch = new StopWatch("testConcurrentSearchIsCreatedBeforeNowAndIsDescendant");
        stopWatch.start(Thread.currentThread().getName() + " search jnt:page nodes is created before now and is descendant site node");
        for (int i = 0; i < 1000; i++) {
            service.submit(new Search("select * from [jnt:page] as page where isdescendantnode(page, 'path') and page.[jcr:created] < CAST(" + System.currentTimeMillis() + " as date) "), Boolean.TRUE);
        }
        for (int i = 0; i < 1000; i++) {
            Boolean aBoolean = service.take().get();
        }
        stopWatch.stop();
        logger.error(stopWatch.prettyPrint());
        executor.shutdown();
    }
View Full Code Here

        private final Random random = new Random();
        StopWatch stopWatch;
        private JCRTemplate jcrTemplate;

        public Reader() {
            stopWatch = new StopWatch("ReaderRunnable");
            stopWatch.start(Thread.currentThread().getName() + " reading node");
            jcrTemplate = JCRTemplate.getInstance();
        }
View Full Code Here

        StopWatch stopWatch;
        private JCRTemplate jcrTemplate;
        private String primaryNodeTypeName;

        public Writer(String primaryNodeTypeName) {
            stopWatch = new StopWatch("WriterRunnable");
            jcrTemplate = JCRTemplate.getInstance();
            this.primaryNodeTypeName = primaryNodeTypeName;
        }
View Full Code Here

        private JCRTemplate jcrTemplate;
        private String testQuery;

        public Search(String s) {
            testQuery = s;
            stopWatch = new StopWatch("SearchRunnable");
            jcrTemplate = JCRTemplate.getInstance();
        }
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.