Skip to content

Commit

Permalink
[JBTM-1369] Performance harness
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusgrov committed Apr 14, 2014
1 parent 4759e3a commit c4d7161
Show file tree
Hide file tree
Showing 12 changed files with 458 additions and 384 deletions.
6 changes: 6 additions & 0 deletions ArjunaJTS/jts/pom.xml
Expand Up @@ -116,6 +116,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.narayana</groupId>
<artifactId>test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
@@ -1,3 +1,24 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013 Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.hp.mwtests.ts.jts.remote.hammer;

import com.arjuna.ats.internal.jts.OTSImpleManager;
Expand All @@ -6,8 +27,8 @@
import com.hp.mwtests.ts.jts.TestModule.grid;
import com.hp.mwtests.ts.jts.TestModule.gridHelper;
import com.hp.mwtests.ts.jts.resources.TestUtility;
import com.hp.mwtests.ts.jts.utils.Result;
import com.hp.mwtests.ts.jts.utils.Worker;
import io.narayana.perf.Result;
import io.narayana.perf.Worker;
import org.omg.CosTransactions.NoTransaction;

class GridWorker implements Worker {
Expand Down Expand Up @@ -39,15 +60,17 @@ class GridWorker implements Worker {
}

@Override
public void doWork(Result opts) {
public Object doWork(Object context, int niters, Result opts) {
boolean running = false;
try {
current.begin();
running = true;
gridVar.set(2, 4, newValue, current.get_control());
current.commit(false);
running = false;
opts.setInfo("grid[2,4] should be " + initialValue);
for (int i = 0; i < niters; i++) {
current.begin();
running = true;
gridVar.set(2, 4, newValue, current.get_control());
current.commit(false);
running = false;
opts.setInfo("grid[2,4] should be " + initialValue);
}
} catch (Exception sysEx) {
sysEx.printStackTrace(System.err);
opts.setInfo("work exception " + sysEx.getMessage());
Expand All @@ -66,6 +89,8 @@ public void doWork(Result opts) {
}
}
}

return null;
}

@Override
Expand Down
Expand Up @@ -32,22 +32,9 @@
package com.hp.mwtests.ts.jts.remote.hammer;

import com.arjuna.ats.internal.jts.ORBManager;
import com.arjuna.ats.internal.jts.OTSImpleManager;
import com.arjuna.ats.internal.jts.orbspecific.CurrentImple;
import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.RootOA;
import com.arjuna.orbportability.Services;
import com.hp.mwtests.ts.jts.TestModule.grid;
import com.hp.mwtests.ts.jts.TestModule.gridHelper;
import com.hp.mwtests.ts.jts.resources.TestUtility;
import com.hp.mwtests.ts.jts.utils.PerformanceTester;
import com.hp.mwtests.ts.jts.utils.Result;
import com.hp.mwtests.ts.jts.utils.Worker;
import org.omg.CosTransactions.*;

import java.io.IOException;
import java.io.PrintWriter;
import com.arjuna.orbportability.*;
import io.narayana.perf.PerformanceTester;
import io.narayana.perf.Result;

public class PerfHammer
{
Expand All @@ -66,11 +53,14 @@ public static void main(String[] args) throws Exception

PerformanceTester tester = new PerformanceTester(10, 10);
GridWorker worker = new GridWorker(myORB, gridReference);
Result opts = new Result(false, 10, 100, 1, false, true, 0, false, true, true, "Unknown");
Result opts = new Result(10, 100);

try {
tester.measureThroughput(new PrintWriter(System.out), worker, opts);
System.out.printf("Test performance: %s%n", opts.toString());
tester.measureThroughput(worker, opts);

System.out.printf("Test performance (for orb type %s): %d calls/sec (%d invocations using %d threads with %d errors. Total time %d ms)%n",
ORBInfo.getOrbName(), opts.getThroughput(), opts.getNumberOfCalls(), opts.getThreadCount(),
opts.getErrorCount(), opts.getTotalMillis());
} finally {
tester.fini();
}
Expand Down

0 comments on commit c4d7161

Please sign in to comment.