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());
}
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"));
}
Aggregations