Search in sources :

Example 11 with Measurement

use of io.narayana.perf.Measurement in project narayana by jbosstm.

the class Performance method test.

@Test
public void test() throws Exception {
    int maxTestTime = 0;
    int numberOfCalls = 1000;
    int warmUpCount = 0;
    int numberOfThreads = 1;
    int batchSize = numberOfCalls;
    Measurement measurement = new Measurement.Builder(getClass().getName() + "_test1").maxTestTime(0L).numberOfCalls(numberOfCalls).numberOfThreads(numberOfThreads).batchSize(batchSize).numberOfWarmupCalls(warmUpCount).build().measure(worker, worker);
    Assert.assertEquals(0, measurement.getNumberOfErrors());
    Assert.assertFalse(measurement.getInfo(), measurement.shouldFail());
    System.out.printf("%s%n", measurement.getInfo());
    System.out.println("Average time for empty transaction = " + measurement.getTotalMillis() / (float) numberOfCalls);
    System.out.printf("TPS: %f%n", measurement.getThroughput());
}
Also used : Measurement(io.narayana.perf.Measurement) Test(org.junit.Test)

Example 12 with Measurement

use of io.narayana.perf.Measurement in project narayana by jbosstm.

the class PerfHammer method main.

public static void main(String[] args) throws Exception {
    String gridReference = args[0];
    int numberOfCalls = 1000;
    int threadCount = 10;
    int batchSize = 100;
    int warmUpCount = 0;
    ServerORB orb = new ServerORB();
    ORB myORB = orb.getORB();
    RootOA myOA = orb.getOA();
    String metricName = "JTSRemote_PerfTest_PerfHammer_" + System.getProperty("org.omg.CORBA.ORBClass", myORB.orb().getClass().getName());
    GridWorker worker = new GridWorker(myORB, gridReference);
    Measurement measurement = new Measurement.Builder(metricName).maxTestTime(0L).numberOfCalls(numberOfCalls).numberOfThreads(threadCount).batchSize(batchSize).numberOfWarmupCalls(warmUpCount).build().measure(worker, worker);
    System.out.printf("%s: %d iterations using %d threads with a batch size of %d%n", metricName, numberOfCalls, threadCount, batchSize);
    System.out.printf("%s%n", measurement.getInfo());
    System.out.printf("%s%n%s%n", measurement.getInfo(), (measurement.shouldFail() || measurement.getNumberOfErrors() != 0 ? "Failed" : "Passed"));
}
Also used : Measurement(io.narayana.perf.Measurement) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) RootOA(com.arjuna.orbportability.RootOA) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) ORB(com.arjuna.orbportability.ORB)

Aggregations

Measurement (io.narayana.perf.Measurement)12 Test (org.junit.Test)10 TwoPhaseVolatileStore (com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore)1 ORB (com.arjuna.orbportability.ORB)1 RootOA (com.arjuna.orbportability.RootOA)1 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)1 Worker (io.narayana.perf.Worker)1 SQLException (java.sql.SQLException)1 Date (java.util.Date)1 HeuristicMixedException (javax.transaction.HeuristicMixedException)1 HeuristicRollbackException (javax.transaction.HeuristicRollbackException)1 NotSupportedException (javax.transaction.NotSupportedException)1 RollbackException (javax.transaction.RollbackException)1 SystemException (javax.transaction.SystemException)1