Package org.perf4j

Examples of org.perf4j.StopWatch.stop()


          c.login(new AuthenticationRequest(op.credentials));
        }

        op.executeAndSetResult(c, client.cassandraHost);
        success = true;
        stopWatch.stop(op.stopWatchTagName + ".success_");
        break;

      } catch (Exception ex) {
        HectorException he = exceptionsTranslator.translate(ex);
        if ( he instanceof HInvalidRequestException || he instanceof HCassandraInternalException ) {
View Full Code Here


        monitor.incCounter(Counter.SKIP_HOST_SUCCESS);
        sleepBetweenHostSkips(op.failoverPolicy);
      } finally {
        if ( !success ) {
          monitor.incCounter(op.failCounter);
          stopWatch.stop(op.stopWatchTagName + ".fail_");
        }
        releaseClient(client);
      }
    }
  }
View Full Code Here

        appender.start();

        for (int i = 0; i < 1000; i++) {
            StopWatch stopWatch = new StopWatch("testOverflow");
            Math.random(); //this should happen super fast, faster than the appender's Dispatcher thread can drain
            logger.info(stopWatch.stop());
        }

        //again close the appender
        appender.stop();
        assertTrue("Expected some stop watch messages to get discarded", appender.getNumDiscardedMessages() > 0);
View Full Code Here

        //make a bunch of logs, but not enough to go over the timeslice.
        for (int i = 0; i < 5; i++) {
            StopWatch stopWatch = new Log4JStopWatch("tag1");
            Thread.sleep(10 * i);
            stopWatch.stop();
        }

        //at this point none of the file appenders will have written anything because they haven't been flushed
        assertEquals("", FileUtils.readFileToString(new File("target/stats-shutdownbug.log")));
        assertEquals("", FileUtils.readFileToString(new File("target/graphs-shutdownbug.log")));
View Full Code Here

        Logger logger = lc.getLogger("org.perf4j.CsvAppenderTest");

        for (int i = 0; i < 20; i++) {
            StopWatch stopWatch = new Slf4JStopWatch(logger);
            Thread.sleep(i * 10);
            stopWatch.stop("csvTest");
        }

        //close the appender
        logger.getAppender("coalescingStatistics").stop();

View Full Code Here

        appender.activateOptions();

        for (int i = 0; i < 1000; i++) {
            StopWatch stopWatch = new StopWatch("testOverflow");
            Math.random(); //this should happen super fast, faster than the appender's Dispatcher thread can drain
            logger.info(stopWatch.stop());
        }

        //again close the appender
        appender.close();
        assertTrue("Expected some stop watch messages to get discarded", appender.getNumDiscardedMessages() > 0);
View Full Code Here

        Logger logger = Logger.getLogger("org.perf4j.CsvAppenderTest");

        for (int i = 0; i < 20; i++) {
            StopWatch stopWatch = new Log4JStopWatch(logger);
            Thread.sleep(i * 10);
            stopWatch.stop("csvTest");
        }

        //close the appender
        logger.getAppender("coalescingStatistics").close();

View Full Code Here

            for (int i = 0; i < STOP_WATCH_COUNT; i++) {
                StopWatch stopWatch = new Slf4JStopWatch(loggingTag);
                int sleepTime = (int) (Math.random() * 400);
                try { Thread.sleep(sleepTime); } catch (Exception e) { /*do nothing*/ }
                stopWatch.stop();
            }

            //this last sleep here seems necessary because otherwise Thread.join() above is returning before
            //we're really done.
            try { Thread.sleep(10); } catch (Exception e) { /*ignore*/ }
View Full Code Here

            for (int i = 0; i < STOP_WATCH_COUNT; i++) {
                StopWatch stopWatch = new Log4JStopWatch(loggingTag);
                int sleepTime = (int) (Math.random() * 400);
                try { Thread.sleep(sleepTime); } catch (Exception e) { /*do nothing*/ }
                stopWatch.stop();
            }

            //this last sleep here seems necessary because otherwise Thread.join() above is returning before
            //we're really done.
            try { Thread.sleep(10); } catch (Exception e) { /*ignore*/ }
View Full Code Here

          pr.addRule(p.label, "substr(value,0,0)");
          continue;
        }
        StopWatch stopWatch = new Log4JStopWatch("toProgram1");
        String rule = p.toProgram();
        stopWatch.stop();

        if (rule.contains("null"))
          return null;
        pr.addRule(p.label, rule);
        score += p.getScore();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.