Examples of PerformanceLogger


Examples of at.ipsquare.commons.core.util.PerformanceLogger

     * Meant to cover the full functionality of our {@link PerformanceLogger}.
     */
    @Test
    public void test() throws InterruptedException
    {
        final PerformanceLogger plog = new PerformanceLogger();
        Thread.sleep(1);
        plog.logElapsed();
       
        assertThat(logString(), containsString(TestPerformanceLogger.class.getSimpleName()));
        assertThat(logString(), containsString("test"));
       
        new InnerClass(plog);
        plog.logElapsed("asdf");
       
        assertThat(logString(), containsString("asdf"));
        assertThat(logString(), containsString(InnerClass.class.getSimpleName()));
       
        new Object()
        {
            {
                plog.logElapsedAndRestart("obj");
            }
           
            void strangeConstructIndeed()
            {
                plog.logElapsed("strange");
            }
        }.strangeConstructIndeed();
       
        assertThat(logString(), containsString("obj"));
        assertThat(logString(), containsString("strangeConstructIndeed"));
       
        new Runnable()
        {
            @Override
            public void run()
            {
                plog.logElapsed("running away");
            }
        }.run();
       
        assertThat(logString(), containsString("running"));
       
        PerformanceLogger plog2 = new PerformanceLogger(1000);
        plog2.logElapsed("should-never-be-logged");
        assertThat(logString(), not(containsString("should-never-be-logged")));
        Thread.sleep(1500);
        plog2.logElapsed("should-be-logged");
        assertThat(logString(), containsString("should-be-logged"));
       
        Logger logbackLogger = (Logger) LoggerFactory.getLogger(PerformanceLogger.class);
        logbackLogger.setLevel(Level.ERROR);
        plog.logElapsedAndRestart("do-not-log-me");
View Full Code Here

Examples of at.ipsquare.commons.core.util.PerformanceLogger

    {
        static class InnerInnerClass
        {
            void doStuff() throws InterruptedException
            {
                PerformanceLogger plog = new PerformanceLogger();
                Thread.sleep(5);
                plog.logElapsed("done, bastards");
            }
View Full Code Here

Examples of at.ipsquare.commons.core.util.PerformanceLogger

        if(!requestMatcher.matches(req))
            chain.doFilter(req, res);
        else
        {
            Throwable th = null;
            PerformanceLogger plog = new PerformanceLogger(threshold, performanceLogFormatter());
            try
            {
                chain.doFilter(req, res);
            }
            catch(Throwable e)
            {
                th = e;
            }
            finally
            {
                plog.logElapsed(toLogString(req, res, th));
            }
           
            if(th != null)
            {
                if(th instanceof IOException)
View Full Code Here

Examples of com.arjuna.mwlabs.testframework.utils.PerformanceLogger

            System.out.println("Invalid iteration parameters");
        }
        else
        {
            long thisTime = 0;
            PerformanceLogger logger = new PerformanceLogger("PerformanceTest1");

            logInformation("Performing "+startIters+" - "+endIters+" (step "+incrementIters+") iterations");

            for (long iters=startIters;iters<=endIters;iters += incrementIters)
            {
                if (persistent)
                    thisTime = persistentTest(iters);
                else
                    thisTime = recoverableTest(iters);

                logInformation("Number of Iterations:"+ iters +", Time Taken:" +thisTime);

                logger.addData( iters, (double)((double)iters/((double)thisTime/1000)) );
            }

            try
            {
                logger.output(System.out);
                assertSuccess();
            }
            catch (Exception e)
            {
                System.err.println("Unexpected exception - "+e);
View Full Code Here

Examples of org.jboss.dtf.testframework.utils.PerformanceLogger

            System.out.println("Invalid iteration parameters");
        }
        else
        {
            long thisTime = 0;
            PerformanceLogger logger = new PerformanceLogger("PerformanceTest1");

            logInformation("Performing "+startIters+" - "+endIters+" (step "+incrementIters+") iterations");

            for (long iters=startIters;iters<=endIters;iters += incrementIters)
            {
                if (persistent)
                    thisTime = persistentTest(iters);
                else
                    thisTime = recoverableTest(iters);

                logInformation("Number of Iterations:"+ iters +", Time Taken:" +thisTime);

                logger.addData( iters, (double)((double)iters/((double)thisTime/1000)) );
            }

            try
            {
                logger.output(System.out);
                assertSuccess();
            }
            catch (Exception e)
            {
                System.err.println("Unexpected exception - "+e);
View Full Code Here

Examples of org.jboss.dtf.testframework.utils.PerformanceLogger

    {
        boolean success = false;

        try
        {
            PerformanceLogger perfLogger = new PerformanceLogger( classname + PERF_DATA_PREFIX );

            perfLogger.setXAxisLabel("Number of Threads");
            perfLogger.setYAxisLabel("Tx/sec");

            System.out.println("Threads from "+getMinimumNumberOfThreads()+" to "+getMaximumNumberOfThreads());
            for (int threadCount=getMinimumNumberOfThreads();threadCount<=getMaximumNumberOfThreads();threadCount++)
            {
                PerformanceTest perfTest = (PerformanceTest)Thread.currentThread().getContextClassLoader().loadClass( classname ).newInstance();
                perfTest.setServiceConfigs( configs );
                perfTest.setParameters( _args );

                PerformanceTestRunnerThread[] pRunner = new PerformanceTestRunnerThread[threadCount];

                long startTimeForThreadSet= System.currentTimeMillis();

                for (int count=0;count<threadCount;count++)
                {
                    pRunner[count] = new PerformanceTestRunnerThread( perfTest, getNumberOfIterations() );

                    pRunner[count].start();
                }

                for (int count=0;count<threadCount;count++)
                {
                    pRunner[count].join();
                    success &= pRunner[count].success();
                }

                long endTimeForThreadSet= System.currentTimeMillis();
                long timeTaken = endTimeForThreadSet - startTimeForThreadSet;

                long numberOfTransactions = getNumberOfIterations()*threadCount;
                System.out.println( threadCount +" \t\t "+timeTaken+" \t\t"+(float) (numberOfTransactions/(timeTaken / 1000.0))+"\t\t"+numberOfTransactions);

                double dataX, dataY;

                switch ( _xDataToLog )
                {
                    case NUMBER_OF_TRANSACTIONS :
                    {
                        dataX = numberOfTransactions;
                        break;
                    }
                    case NUMBER_OF_THREADS :
                    default:
                    {
                        dataX = threadCount;
                        break;
                    }
                }

                switch ( _yDataToLog )
                {
                    case TIME_TAKEN :
                    {
                        dataY = timeTaken;
                        break;
                    }
                    case TRANSACTIONS_PER_SECOND :
                    default:
                    {
                        dataY = (numberOfTransactions/(timeTaken / 1000.0));
                        break;
                    }
                }

                perfLogger.addData( dataX, dataY );
            }

            perfLogger.output(System.err);

            if ( _csvFilename != null )
            {
                generateCSV(_csvFilename, perfLogger);
            }
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.