Mail Archive Home | gotm-commits List | August 2005 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Monday, August 8, 2005 @ 15:29:03
Author: rouvoy
Path: /cvsroot/gotm/gotm-jts/examples/benchmark
Added: src/fractal/org/objectweb/benchmark/FcBenchmark2PC.fractal
src/fractal/org/objectweb/benchmark/FcBenchmarkAPC.fractal
src/fractal/org/objectweb/benchmark/FcBenchmarkJTS.fractal
src/java/org/objectweb/benchmark/api/Outcome.java
src/java/org/objectweb/benchmark/api/Scenario.java
src/java/org/objectweb/benchmark/api/Visitor.java
src/java/org/objectweb/benchmark/jts/Benchmark2PC.java
src/java/org/objectweb/benchmark/jts/BenchmarkAPC.java
src/java/org/objectweb/benchmark/jts/BenchmarkJTS.java
src/java/org/objectweb/benchmark/jts/CommitProtocolIteratable.java
src/java/org/objectweb/benchmark/jts/CommitProtocolResource.java
src/java/org/objectweb/benchmark/jts/JavaTransactionServiceIteratable.java
src/java/org/objectweb/benchmark/jts/SynchronizationIteratable.java
src/java/org/objectweb/benchmark/jts/XAResourceIteratable.java
src/java/org/objectweb/benchmark/jts/data/Counter.java
src/java/org/objectweb/benchmark/jts/data/CounterAttributes.java
src/java/org/objectweb/benchmark/jts/data/CounterImpl.java
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioAbstract.java
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioCommit.java
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioRollback.java
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXACommit.java
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXARollback.java
src/java/org/objectweb/benchmark/lib/Benchmark.java
src/java/org/objectweb/benchmark/lib/ConfigurationIterator.java
src/java/org/objectweb/benchmark/lib/OutcomeImpl.java
src/java/org/objectweb/benchmark/lib/RandomScenario.java
src/java/org/objectweb/benchmark/lib/ScenarioAbstract.java
src/java/org/objectweb/benchmark/lib/ScenarioIterator.java
src/java/org/objectweb/benchmark/lib/Timer.java
src/java/org/objectweb/benchmark/lib/visitor/Rename.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorAvg.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorConcat.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorDecorator.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorDisplay.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorIdentity.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorInverse.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorMax.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorMin.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorRename.java
src/java/org/objectweb/benchmark/lib/visitor/VisitorWriter.java
Modified: .cvsignore build.xml
Removed: src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal
src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal
src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal
src/java/org/objectweb/gotm/jts/benchmark/ClientAttributeController.java
src/java/org/objectweb/gotm/jts/benchmark/Counter.java
src/java/org/objectweb/gotm/jts/benchmark/CounterAttributes.java
src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java
src/java/org/objectweb/gotm/jts/benchmark/InvokeRunnableAction.java
src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java
src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioAttributeController.java
src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java
src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java
src/java/org/objectweb/gotm/jts/benchmark/tools/Scenario.java
src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieAverage.java
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMax.java
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieVisitor.java
src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java
src/java/org/objectweb/gotm/jts/benchmark/tools/VisitorImpl.java
src/xml/benchmark.xml
* Refactoring of the JTS Benchmark example.
---------------------------------------------------------------------------------------+
.cvsignore
| 2
build.xml
| 56 +-
src/fractal/org/objectweb/benchmark/FcBenchmark2PC.fractal
| 16
src/fractal/org/objectweb/benchmark/FcBenchmarkAPC.fractal
| 16
src/fractal/org/objectweb/benchmark/FcBenchmarkJTS.fractal
| 16
src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal
| 28 -
src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal
| 14
src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal
| 14
src/java/org/objectweb/benchmark/api/Outcome.java
| 64 ++
src/java/org/objectweb/benchmark/api/Scenario.java
| 56 ++
src/java/org/objectweb/benchmark/api/Visitor.java
| 59 ++
src/java/org/objectweb/benchmark/jts/Benchmark2PC.java
| 113 ++++
src/java/org/objectweb/benchmark/jts/BenchmarkAPC.java
| 112 ++++
src/java/org/objectweb/benchmark/jts/BenchmarkJTS.java
| 119 ++++
src/java/org/objectweb/benchmark/jts/CommitProtocolIteratable.java
| 136 +++++
src/java/org/objectweb/benchmark/jts/CommitProtocolResource.java
| 122 +++++
src/java/org/objectweb/benchmark/jts/JavaTransactionServiceIteratable.java
| 102 ++++
src/java/org/objectweb/benchmark/jts/SynchronizationIteratable.java
| 100 ++++
src/java/org/objectweb/benchmark/jts/XAResourceIteratable.java
| 155 ++++++
src/java/org/objectweb/benchmark/jts/data/Counter.java
| 55 ++
src/java/org/objectweb/benchmark/jts/data/CounterAttributes.java
| 53 ++
src/java/org/objectweb/benchmark/jts/data/CounterImpl.java
| 239 ++++++++++
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioAbstract.java
| 92 +++
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioCommit.java
| 68 ++
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioRollback.java
| 68 ++
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXACommit.java
| 72 +++
src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXARollback.java
| 68 ++
src/java/org/objectweb/benchmark/lib/Benchmark.java
| 98 ++++
src/java/org/objectweb/benchmark/lib/ConfigurationIterator.java
| 93 +++
src/java/org/objectweb/benchmark/lib/OutcomeImpl.java
| 96 ++++
src/java/org/objectweb/benchmark/lib/RandomScenario.java
| 78 +++
src/java/org/objectweb/benchmark/lib/ScenarioAbstract.java
| 123 +++++
src/java/org/objectweb/benchmark/lib/ScenarioIterator.java
| 101 ++++
src/java/org/objectweb/benchmark/lib/Timer.java
| 74 +++
src/java/org/objectweb/benchmark/lib/visitor/Rename.java
| 44 +
src/java/org/objectweb/benchmark/lib/visitor/VisitorAvg.java
| 50 ++
src/java/org/objectweb/benchmark/lib/visitor/VisitorConcat.java
| 47 +
src/java/org/objectweb/benchmark/lib/visitor/VisitorDecorator.java
| 77 +++
src/java/org/objectweb/benchmark/lib/visitor/VisitorDisplay.java
| 65 ++
src/java/org/objectweb/benchmark/lib/visitor/VisitorIdentity.java
| 68 ++
src/java/org/objectweb/benchmark/lib/visitor/VisitorInverse.java
| 59 ++
src/java/org/objectweb/benchmark/lib/visitor/VisitorMax.java
| 53 ++
src/java/org/objectweb/benchmark/lib/visitor/VisitorMin.java
| 53 ++
src/java/org/objectweb/benchmark/lib/visitor/VisitorRename.java
| 75 +++
src/java/org/objectweb/benchmark/lib/visitor/VisitorWriter.java
| 86 +++
src/java/org/objectweb/gotm/jts/benchmark/ClientAttributeController.java
| 50 --
src/java/org/objectweb/gotm/jts/benchmark/Counter.java
| 55 --
src/java/org/objectweb/gotm/jts/benchmark/CounterAttributes.java
| 53 --
src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java
| 211 --------
src/java/org/objectweb/gotm/jts/benchmark/InvokeRunnableAction.java
| 79 ---
src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java
| 169 -------
src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioAttributeController.java
| 50 --
src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java
| 194 --------
src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java
| 101 ----
src/java/org/objectweb/gotm/jts/benchmark/tools/Scenario.java
| 52 --
src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java
| 101 ----
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieAverage.java
| 58 --
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMax.java
| 60 --
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java
| 62 --
src/java/org/objectweb/gotm/jts/benchmark/tools/SerieVisitor.java
| 52 --
src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java
| 74 ---
src/java/org/objectweb/gotm/jts/benchmark/tools/VisitorImpl.java
| 62 --
src/xml/benchmark.xml
| 18
63 files changed, 3289 insertions(+), 1567 deletions(-)
Index: gotm-jts/examples/benchmark/.cvsignore
diff -u gotm-jts/examples/benchmark/.cvsignore:1.1
gotm-jts/examples/benchmark/.cvsignore:1.2
--- gotm-jts/examples/benchmark/.cvsignore:1.1 Tue Jun 28 10:02:28 2005
+++ gotm-jts/examples/benchmark/.cvsignore Mon Aug 8 15:29:01 2005
@@ -1,2 +1,2 @@
-build
output
+bench-apc.txt
Index: gotm-jts/examples/benchmark/build.xml
diff -u gotm-jts/examples/benchmark/build.xml:1.2
gotm-jts/examples/benchmark/build.xml:1.3
--- gotm-jts/examples/benchmark/build.xml:1.2 Tue Jun 28 15:30:31 2005
+++ gotm-jts/examples/benchmark/build.xml Mon Aug 8 15:29:02 2005
@@ -21,7 +21,7 @@
<!-- Initial developer(s): Romain Rouvoy. -->
<!-- Contributor(s): ______________________________________. -->
-<!-- $Id: build.xml,v 1.2 2005/06/28 13:30:31 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.3 2005/08/08 13:29:02 rouvoy Exp $ -->
<!-- ==================================================================== -->
<project name="JTS Benchmark" default="all">
@@ -61,9 +61,6 @@
<mkdir dir="${build.dir}/${class.dir}"/>
<java.c srcdir="${basedir}/${src.dir}/${java.dir}"/>
<copy todir="${build.dir}/${class.dir}">
- <fileset dir="${basedir}/${src.dir}/${xml.dir}" includes="**/*"/>
- </copy>
- <copy todir="${build.dir}/${class.dir}">
<fileset dir="${build.dir}/${lib.dir}" includes="**/*.properties"/>
</copy>
</target>
@@ -77,7 +74,51 @@
<target name="import" depends="bench-build,clear"/>
<target name="execute" depends="import"
- description="run local JTS example">
+ description="execute All Benchmarks">
+ <property name="imported" value="true"/>
+ <antcall target="execute-2pc"/>
+ <antcall target="execute-apc"/>
+ <antcall target="execute-jts"/>
+ </target>
+
+ <target name="execute-jts" depends="import" unless="imported"
+ description="execute JTS Benchmark">
+ <property name="julia.cfg" value="${build.dir}/${lib.dir}/julia.cfg"/>
+ <property name="cache.cfg" value="${build.dir}/${lib.dir}/cache.cfg"/>
+ <java classname="org.objectweb.fractal.adl.Launcher"
+ classpathref="classpath"
+ fork="yes"
+ failonerror="yes">
+ <sysproperty key="fractal.provider"
+ value="org.objectweb.fractal.julia.Julia"/>
+ <sysproperty key="julia.loader"
+ value="org.objectweb.fractal.julia.loader.DynamicLoader" />
+ <sysproperty key="julia.config"
+ value="${julia.cfg},${cache.cfg}" />
+ <arg line=" -fractal org.objectweb.benchmark.FcBenchmarkJTS r"/>
+ </java>
+ </target>
+
+ <target name="execute-2pc" depends="import" unless="imported"
+ description="execute Commit Protocol Benchmark">
+ <property name="julia.cfg" value="${build.dir}/${lib.dir}/julia.cfg"/>
+ <property name="cache.cfg" value="${build.dir}/${lib.dir}/cache.cfg"/>
+ <java classname="org.objectweb.fractal.adl.Launcher"
+ classpathref="classpath"
+ fork="yes"
+ failonerror="yes">
+ <sysproperty key="fractal.provider"
+ value="org.objectweb.fractal.julia.Julia"/>
+ <sysproperty key="julia.loader"
+ value="org.objectweb.fractal.julia.loader.DynamicLoader" />
+ <sysproperty key="julia.config"
+ value="${julia.cfg},${cache.cfg}" />
+ <arg line=" -fractal org.objectweb.benchmark.FcBenchmark2PC r"/>
+ </java>
+ </target>
+
+ <target name="execute-apc" depends="import" unless="imported"
+ description="execute Adaptive Commit Protocol Benchmark">
<property name="julia.cfg" value="${build.dir}/${lib.dir}/julia.cfg"/>
<property name="cache.cfg" value="${build.dir}/${lib.dir}/cache.cfg"/>
<java classname="org.objectweb.fractal.adl.Launcher"
@@ -90,10 +131,7 @@
value="org.objectweb.fractal.julia.loader.DynamicLoader" />
<sysproperty key="julia.config"
value="${julia.cfg},${cache.cfg}" />
-<!-- <jvmarg line="-XX:NewSize=128m -XX:MaxNewSize=128m
-XX:SurvivorRatio=8 -Xms512m -Xmx512m"/>-->
-<!-- <jvmarg
line="-Xbootclasspath/p:${build.dir}/${lib.dir}/thread.jar"/>-->
- <arg line=" -fractal org.objectweb.gotm.jts.benchmark.FcApplication
r"/>
- <!-- <arg line="-fractal org.objectweb.gotm.lib.xid.FcXidStateFctr
r"/> -->
+ <arg line=" -fractal org.objectweb.benchmark.FcBenchmarkAPC r"/>
</java>
</target>
</project>
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmark2PC.fractal
diff -u /dev/null
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmark2PC.fractal:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmark2PC.fractal
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.benchmark.FcBenchmark2PC">
+
+ <interface name="r" role="server"
+ signature="java.lang.Runnable"/>
+
+ <component name="FcBench"
+ definition="org.objectweb.benchmark.jts.FcBenchmark2PC"/>
+
+ <binding client="this.r"
+ server="FcBench.runnable"/>
+</definition>
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmarkAPC.fractal
diff -u /dev/null
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmarkAPC.fractal:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmarkAPC.fractal
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.benchmark.FcBenchmarkAPC">
+
+ <interface name="r" role="server"
+ signature="java.lang.Runnable"/>
+
+ <component name="FcBench"
+ definition="org.objectweb.benchmark.jts.FcBenchmarkAPC"/>
+
+ <binding client="this.r"
+ server="FcBench.runnable"/>
+</definition>
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmarkJTS.fractal
diff -u /dev/null
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmarkJTS.fractal:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/fractal/org/objectweb/benchmark/FcBenchmarkJTS.fractal
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.benchmark.FcBenchmarkJTS">
+
+ <interface name="r" role="server"
+ signature="java.lang.Runnable"/>
+
+ <component name="FcBench"
+ definition="org.objectweb.benchmark.jts.FcBenchmarkJTS"/>
+
+ <binding client="this.r"
+ server="FcBench.runnable"/>
+</definition>
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal
diff -u
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal:1.2
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal:removed
---
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal:1.2
Mon Jul 11 10:27:08 2005
+++
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal
Mon Aug 8 15:29:03 2005
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC
- "-//objectweb.org//DTD Fractal ADL 2.0//EN"
- "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
-
-<definition name="org.objectweb.gotm.jts.benchmark.FcApplication">
-
- <interface name="r" role="server"
- signature="java.lang.Runnable"/>
-
- <component name="FcClient"
- definition="org.objectweb.gotm.jts.benchmark.FcJtaClient"/>
- <component name="FcScenario"
-
definition="org.objectweb.gotm.jts.benchmark.FcTransactionScenarioImpl"/>
- <component name="FcCounter"
- definition="org.objectweb.gotm.jts.benchmark.TpCounterImpl"/>
- <component name="FcTransactionManager"
- definition="org.objectweb.gotm.lib.JtsTransactionManager"/>
-
- <binding client="this.r"
- server="FcClient.runnable"/>
- <binding client="FcClient.transaction-manager"
- server="FcTransactionManager.transaction-manager"/>
- <binding client="FcClient.scenario"
- server="FcScenario.scenario"/>
- <binding client="FcScenario.counter"
- server="FcCounter.component"/>
-</definition>
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal
diff -u
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal:1.2
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal:removed
---
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal:1.2
Mon Jul 11 10:27:08 2005
+++
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal
Mon Aug 8 15:29:03 2005
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC
- "-//objectweb.org//DTD Fractal ADL 2.0//EN"
- "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
-
-<definition name="org.objectweb.gotm.jts.benchmark.FcExplorer">
- <component name="FcExplorer"
- definition="org.objectweb.gotm.lib.FcBenchExplorer"/>
- <component name="FcApplication"
- definition="org.objectweb.gotm.jts.benchmark.FcApplication"/>
-
- <binding client="FcExplorer.fcAppl"
- server="FcApplication.component"/>
-</definition>
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal
diff -u
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal:1.1
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal:removed
---
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal:1.1
Mon Jul 11 10:27:08 2005
+++
gotm-jts/examples/benchmark/src/fractal/org/objectweb/gotm/lib/FcBenchExplorer.fractal
Mon Aug 8 15:29:03 2005
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
-<!--<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/basic.dtd">-->
-
-<definition name="org.objectweb.gotm.lib.FcBenchExplorer">
- <interface name="fcAppl" role="client"
- signature="org.objectweb.fractal.api.Component" />
-
- <content class="BrowserImpl"/>
-
- <attributes signature="BrowserAttributes">
- <attribute value="benchmark.xml" name="ConfigFiles"/>
- </attributes>
-</definition>
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Outcome.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Outcome.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Outcome.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,64 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: Outcome.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+package org.objectweb.benchmark.api;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 20 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="outcome"
+ */
+public interface Outcome {
+
+ /**
+ * @param name identifier of the values to retreive.
+ * @return the list of values associated.
+ */
+ List values(String name);
+
+ /**
+ * @return the names of the measures.
+ */
+ String[] names();
+
+ /**
+ * @param name
+ * @param value
+ */
+ void store(String name, Number value);
+
+ /**
+ * Visits the outcome to compute it.
+ * @param visitor the computation to apply.
+ */
+ void accept(Visitor visitor);
+
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Scenario.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Scenario.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Scenario.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,56 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Scenario.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.api;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 24 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="scenario"
+ */
+public interface Scenario
+{
+ /** Fractal ADL Identifier for the <code>Scenario</code> interface.*/
+ static final String SCENARIO = "scenario";
+
+ /**
+ * Sets the benchmark parameters.
+ * @param config the parameters of the scenario.
+ */
+ void updateConfiguration(Map config) ;
+
+ /**
+ * Executes the scenario.
+ * @return the outcome of the execution.
+ * @throws Exception exception that could be raised by the scenario.
+ */
+ Outcome run() throws Exception;
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Visitor.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Visitor.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/api/Visitor.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,59 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Visitor.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.api;
+
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 21 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="visitor"
+ */
+public interface Visitor {
+ /** Fractal ADL Identifier for the <code>Visitor</code> interface. */
+ static final String VISITOR = "visitor";
+
+ /**
+ * Initialize the visitor.
+ */
+ void init();
+
+ /**
+ * @param name
+ * @param values
+ */
+ void visit(String name, List values);
+
+ /**
+ * @return the result of the visit.
+ */
+ Outcome compute();
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/Benchmark2PC.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/Benchmark2PC.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/Benchmark2PC.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,113 @@
+/*====================================================================
+
+ ObjectWeb GoTM project - http://gotm.objectweb.org
+ Contact: gotm@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): ______________________________________.
+
+ ---------------------------------------------------------------------
+ $Id: Benchmark2PC.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.benchmark.jts;
+
+import java.io.FileWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioXACommit;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioXARollback;
+import org.objectweb.benchmark.lib.Benchmark;
+import org.objectweb.benchmark.lib.ConfigurationIterator;
+import org.objectweb.benchmark.lib.ScenarioIterator;
+import org.objectweb.benchmark.lib.visitor.Rename;
+import org.objectweb.benchmark.lib.visitor.VisitorAvg;
+import org.objectweb.benchmark.lib.visitor.VisitorRename;
+import org.objectweb.benchmark.lib.visitor.VisitorWriter;
+import org.objectweb.fractal.lib.LoggablePrimitive;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 3 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="runnable" signature="java.lang.Runnable"
+ */
+public class Benchmark2PC
+ extends LoggablePrimitive
+ implements Runnable {
+ /** <code>MIN</code> . */
+ public static int MIN = 0 ;
+ /** <code>MAX</code> . */
+ public static int MAX = 100 ;
+ /** <code>STEP</code> . */
+ public static int STEP = 2 ;
+ /** <code>WARM</code> . */
+ public static int WARM = 10 ;
+ /** <code>BENCH</code> . */
+ public static int BENCH = 100 ;
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ System.out.println("[2PC] Configuring the transaction services...");
+ Map tm = new HashMap();
+ tm.put("GoTM-2PC", "org.objectweb.gotm.lib.protocol.Tp2PC");
+ tm.put("GoTM-2PCPA", "org.objectweb.gotm.lib.protocol.Tp2PCPA");
+ tm.put("GoTM-2PCPC", "org.objectweb.gotm.lib.protocol.Tp2PCPC");
+
+ System.out.println("[2PC] Configuring the benchmark...");
+ Scenario commit1 = new TransactionScenarioXACommit("commit(true)");
+ commit1 = new Benchmark(commit1, new VisitorAvg(), WARM, BENCH);
+ commit1 = new ConfigurationIterator(commit1, new
XAResourceIteratable(MIN, MAX, STEP,false));
+
+ Scenario commit2 = new TransactionScenarioXACommit("commit(false)");
+ commit2 = new Benchmark(commit2, new VisitorAvg(), WARM, BENCH);
+ commit2 = new ConfigurationIterator(commit2, new
XAResourceIteratable(MIN, MAX, STEP,true));
+
+ Scenario abort = new TransactionScenarioXARollback("rollback");
+ abort = new Benchmark(abort, new VisitorAvg(), WARM, BENCH);
+ abort = new ConfigurationIterator(abort, new
XAResourceIteratable(MIN, MAX, STEP));
+
+ Scenario scenario = new ScenarioIterator(new Scenario[] {
commit1,commit2,abort});
+ Iterable tmi = new CommitProtocolIteratable(tm);
+ scenario = new ConfigurationIterator(scenario, tmi, new
VisitorRename((Rename) tmi));
+
+ System.out.println("[2PC] Running Scenarios...");
+ try {
+ scenario.run().accept(new VisitorWriter(new
FileWriter("benchmark-2pc.txt")));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.exit(0);
+ }
+
+ /**
+ * @param args
+ * command line arguments
+ */
+ public static void main(String[] args) {
+ new Benchmark2PC().run();
+ }
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/BenchmarkAPC.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/BenchmarkAPC.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/BenchmarkAPC.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,112 @@
+/*====================================================================
+
+ ObjectWeb GoTM project - http://gotm.objectweb.org
+ Contact: gotm@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): ______________________________________.
+
+ ---------------------------------------------------------------------
+ $Id: BenchmarkAPC.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.benchmark.jts;
+
+import java.io.FileWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioXACommit;
+import org.objectweb.benchmark.lib.Benchmark;
+import org.objectweb.benchmark.lib.ConfigurationIterator;
+import org.objectweb.benchmark.lib.visitor.Rename;
+import org.objectweb.benchmark.lib.visitor.VisitorAvg;
+import org.objectweb.benchmark.lib.visitor.VisitorDecorator;
+import org.objectweb.benchmark.lib.visitor.VisitorRename;
+import org.objectweb.benchmark.lib.visitor.VisitorWriter;
+import org.objectweb.fractal.lib.LoggablePrimitive;
+import org.objectweb.gotm.lib.JtsFactory;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 3 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="runnable" signature="java.lang.Runnable"
+ */
+public class BenchmarkAPC
+ extends LoggablePrimitive
+ implements Runnable {
+ /** <code>MIN</code> . */
+ public static int ITER = 200 ;
+ /** <code>STEP</code> . */
+ public static int STEP = 20 ;
+ /** <code>WARM</code> . */
+ public static int WARM = 1 ;
+ /** <code>BENCH</code> . */
+ public static int BENCH = 4 ;
+
+ /** <code>DESC</code> Descriptor of the Adaptive Transaction Manager to
use. */
+ private static final String DESC =
"org.objectweb.gotm.lib.JtsAdaptiveTransactionManager";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ Map context = new HashMap();
+ Map configs = new HashMap();
+
+ System.out.println("[APC] Configuring the transaction services...");
+
context.put("communication","org.objectweb.gotm.lib.event.TpEventBusThread");
+ context.put("protocol", "org.objectweb.gotm.lib.protocol.Tp2PC");
+ configs.put("GoTM", JtsFactory.create(context));
+ context.put("protocol", "org.objectweb.gotm.lib.protocol.Tp2PC");
+ configs.put("GoTM-2PC", JtsFactory.create(context));
+ context.put("protocol", "org.objectweb.gotm.lib.protocol.Tp2PCPA");
+ configs.put("GoTM-2PCPA", JtsFactory.create(context));
+ context.put("protocol", "org.objectweb.gotm.lib.protocol.Tp2PCPC");
+ configs.put("GoTM-2PCPC", JtsFactory.create(context));
+ configs.put("GoTM-SAPC", JtsFactory.create(DESC, new HashMap()));
+ Iterable commit_protocols = new
JavaTransactionServiceIteratable(configs);
+
+ System.out.println("[APC] Configuring the benchmark...");
+ Scenario scenario = new TransactionScenarioXACommit("commit
protocol");
+ scenario = new Benchmark(scenario, new VisitorAvg(), WARM, BENCH);
+ scenario = new ConfigurationIterator(scenario, new
CommitProtocolResource(ITER, STEP));
+ scenario = new ConfigurationIterator(scenario, commit_protocols, new
VisitorRename((Rename) commit_protocols));
+
+ System.out.println("[APC] Running Scenarios...");
+ try {
+ scenario.run().accept(new VisitorDecorator(new VisitorWriter(new
FileWriter("benchmark-apc.txt"))));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.exit(0);
+ }
+
+ /**
+ * @param args
+ * command line arguments
+ */
+ public static void main(String[] args) {
+ new BenchmarkAPC().run();
+ }
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/BenchmarkJTS.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/BenchmarkJTS.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/BenchmarkJTS.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,119 @@
+/*====================================================================
+
+ ObjectWeb GoTM project - http://gotm.objectweb.org
+ Contact: gotm@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): ______________________________________.
+
+ ---------------------------------------------------------------------
+ $Id: BenchmarkJTS.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.benchmark.jts;
+
+import java.io.FileWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioCommit;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioRollback;
+import org.objectweb.benchmark.lib.Benchmark;
+import org.objectweb.benchmark.lib.ConfigurationIterator;
+import org.objectweb.benchmark.lib.ScenarioIterator;
+import org.objectweb.benchmark.lib.visitor.Rename;
+import org.objectweb.benchmark.lib.visitor.VisitorAvg;
+import org.objectweb.benchmark.lib.visitor.VisitorRename;
+import org.objectweb.benchmark.lib.visitor.VisitorWriter;
+import org.objectweb.fractal.lib.LoggablePrimitive;
+import org.objectweb.gotm.lib.JtsFactory;
+import org.objectweb.jotm.Jotm;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 3 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="runnable" signature="java.lang.Runnable"
+ */
+public class BenchmarkJTS
+ extends LoggablePrimitive
+ implements Runnable {
+ /** <code>MIN</code> . */
+ public static int MIN = 0 ;
+ /** <code>MAX</code> . */
+ public static int MAX = 50000 ;
+ /** <code>STEP</code> . */
+ public static int STEP = 50 ;
+ /** <code>WARM</code> . */
+ public static int WARM = 10 ;
+ /** <code>BENCH</code> . */
+ public static int BENCH = 100 ;
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ Map tm = new HashMap();
+ Map ctx = new HashMap() ;
+ System.out.println("[JTS] Configuring the transaction services...");
+
ctx.put("communication","org.objectweb.gotm.lib.event.TpEventBusSimple");
+ ctx.put("protocol", "org.objectweb.gotm.lib.protocol.Tp2PCNoLog");
+ tm.put("GoTM", JtsFactory.create(ctx));
+ Jotm jotm = null;
+ try {
+ jotm = new Jotm(true, false);
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ tm.put("JOTM", jotm.getTransactionManager());
+ Iterable tmi = new JavaTransactionServiceIteratable(tm);
+
+ System.out.println("[JTS] Configuring the benchmark...");
+ Scenario scenario = new ScenarioIterator(new Scenario[] {
+ new TransactionScenarioCommit("commit"),
+ new TransactionScenarioRollback("abort")});
+ scenario = new Benchmark(scenario, new VisitorAvg(), WARM, BENCH);
+ scenario = new ConfigurationIterator(scenario, new
SynchronizationIteratable(
+ MIN, MAX, STEP));
+ scenario = new ConfigurationIterator(scenario, tmi, new
VisitorRename(
+ (Rename) tmi));
+ System.out.println("[JTS] Running Scenarios...");
+ try {
+ scenario.run().accept(new VisitorWriter(new
FileWriter("benchmark-jts.txt")));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ jotm.stop();
+ System.exit(0);
+ }
+
+ /**
+ * @param args
+ * command line arguments
+ */
+ public static void main(String[] args) {
+ new BenchmarkJTS().run();
+ }
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/CommitProtocolIteratable.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/CommitProtocolIteratable.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/CommitProtocolIteratable.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,136 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: CommitProtocolIteratable.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+package org.objectweb.benchmark.jts;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioAbstract;
+import org.objectweb.benchmark.lib.visitor.Rename;
+import org.objectweb.gotm.lib.JtsFactory;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class CommitProtocolIteratable
+ implements Iterable, Rename {
+ /** list of <code>tx_manager</code> to benchmark. */
+ final Map tx_manager;
+
+ /** <code>name</code> . */
+ String name;
+
+ /**
+ * @param tm
+ */
+ public CommitProtocolIteratable(Map tm) {
+ this.tx_manager = new HashMap();
+ Map ctx = new HashMap();
+ ctx.put("communication",
+ "org.objectweb.gotm.lib.event.TpEventBusThread");
+
+ for (Iterator i=tm.entrySet().iterator();i.hasNext();) {
+ Entry e = (Entry) i.next();
+ System.out.println("[JTS] Loading the "+e.getKey()+"
configuration ["+e.getValue()+"]...");
+ String protocol = (String) e.getValue();
+ ctx.put("protocol", protocol);
+ this.tx_manager.put(e.getKey(), JtsFactory.create(ctx));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.objectweb.benchmark.lib.visitor.Rename#rename(java.lang.String)
+ */
+ public String rename(String original) {
+ return original + " (" + name + ")";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator iterator() {
+ return new CommitProtocolIterator();
+ }
+
+ /**
+ * GoTM Commit Protocol Generator & Iterator implementation.
+ *
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 4 août 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+ private class CommitProtocolIterator
+ implements Iterator {
+ private Iterator entries = tx_manager.entrySet().iterator();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ return entries.hasNext();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Iterator#next()
+ */
+ public Object next() {
+ Entry e = (Entry) entries.next();
+ Map next = new HashMap();
+ name = (String) e.getKey();
+ System.out
+ .println(("[JTS] Benchmarking the " + name + "
configuration..."));
+ next.put(TransactionScenarioAbstract.TX_MANAGER, e.getValue());
+ return next;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Iterator#remove()
+ */
+ public void remove() {
+ // empty body
+ }
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/CommitProtocolResource.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/CommitProtocolResource.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/CommitProtocolResource.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,122 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: CommitProtocolResource.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.benchmark.jts.data.CounterImpl;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioAbstract;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 8 août 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class CommitProtocolResource
+ implements Iterable {
+ /** <code>NB_XA</code> number of xa resource to instanciate. */
+ public static final int NB_XA = 20;
+ final int iteration,step;
+
+ /**
+ * @param iteration
+ * @param step
+ */
+ public CommitProtocolResource(int iteration, int step) {
+ this.iteration = iteration;
+ this.step = step;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator iterator() {
+ return new CommitProtocolResourceIterator();
+ }
+
+ /**
+ * XA Resource Generator & Iterator implementation.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 4 août 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+ private class CommitProtocolResourceIterator implements Iterator {
+ private final List commit=new ArrayList(),abort = new
ArrayList();
+ private final Map next = new HashMap();
+ private int counter = 0;
+
+ /**
+ * Constructor
+ */
+ public CommitProtocolResourceIterator() {
+ for (int i=0 ; i<NB_XA;i++) {
+ commit.add(new CounterImpl(false));
+ abort.add(new CounterImpl(true));
+ }
+ }
+
+ /**
+ * @param xa the list of XA resources.
+ */
+ private final void xa_res(List xa) {
+ this.next.put(TransactionScenarioAbstract.XA_RESOURCES,xa);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ return counter<iteration;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next() {
+ xa_res(((counter/step)%2 == 0)?commit:abort);
+ System.out.println("[I="+counter+"] Loading "+NB_XA+" XA
resources (fails="+((counter/step)%2 == 0?"false":"true")+")...");
+ counter++;
+ return this.next;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove() {
+ // empty body.
+ }
+ }
+ }
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/JavaTransactionServiceIteratable.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/JavaTransactionServiceIteratable.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/JavaTransactionServiceIteratable.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,102 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: JavaTransactionServiceIteratable.java,v 1.1 2005/08/08 13:29:02 rouvoy
Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioAbstract;
+import org.objectweb.benchmark.lib.visitor.Rename;
+
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class JavaTransactionServiceIteratable
+ implements Iterable, Rename {
+ /** list of <code>tx_manager</code> to benchmark. */
+ final Map tx_manager ;
+ String name ;
+
+ /**
+ * @param tm
+ */
+ public JavaTransactionServiceIteratable(Map tm) {
+ this.tx_manager = tm;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.benchmark.lib.visitor.Rename#rename(java.lang.String)
+ */
+ public String rename(String original) {
+ return "["+name+"] "+original;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator iterator() {
+ return new TransactionManagerIterator();
+ }
+
+ private class TransactionManagerIterator implements Iterator {
+ private Iterator entries = tx_manager.entrySet().iterator();
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ return entries.hasNext();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next() {
+ Entry e = (Entry) entries.next();
+ Map next = new HashMap();
+ name= (String) e.getKey();
+ System.out.println(("Benchmarking the "+name+"
configuration..."));
+ next.put(TransactionScenarioAbstract.TX_MANAGER, e.getValue());
+ return next;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove() {
+ // empty body
+ }
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/SynchronizationIteratable.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/SynchronizationIteratable.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/SynchronizationIteratable.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,100 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: SynchronizationIteratable.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.benchmark.jts.data.CounterImpl;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioAbstract;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class SynchronizationIteratable
+ implements Iterable {
+
+ final int first,last,step;
+
+ private class SynchronizationIterator implements Iterator {
+ private final Map next = new HashMap();
+ private int index = SynchronizationIteratable.this.first;
+
+ /**
+ *
+ */
+ public SynchronizationIterator() {
+ this.next.put(TransactionScenarioAbstract.SYNCHRONIZATIONS,new
ArrayList());
+ }
+
+ private List sync() { return (List)
this.next.get(TransactionScenarioAbstract.SYNCHRONIZATIONS); }
+
+ private void load() {
+ while (sync().size()<index) {
+ sync().add(new CounterImpl());
+ }
+ }
+
+ public boolean hasNext() {
+ return index <= SynchronizationIteratable.this.last;
+ }
+
+ public Object next() {
+ load();
+ System.out.println("Loading "+sync().size()+" synchronization
objects...");
+ index += SynchronizationIteratable.this.step;
+ return this.next;
+ }
+
+ public void remove() {
+ // empty body.
+ }
+ }
+
+ /**
+ * @param first
+ * @param last
+ * @param step
+ */
+ public SynchronizationIteratable(int first, int last, int step) {
+ this.first = first ;
+ this.last = last ;
+ this.step = step ;
+ }
+
+ public Iterator iterator() {
+ return new SynchronizationIterator();
+ }
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/XAResourceIteratable.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/XAResourceIteratable.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/XAResourceIteratable.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,155 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: XAResourceIteratable.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.benchmark.jts.data.CounterImpl;
+import org.objectweb.benchmark.jts.scenario.TransactionScenarioAbstract;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="xa-resource-iterable"
+ */
+public class XAResourceIteratable
+ implements Iterable {
+ /** <code>SWITCH</code> sequence size of the configuration to create
with the failure flag. */
+ public static final int SWITCH = 4;
+ final int first,last,step;
+ boolean fails=true,random=false;
+
+ /**
+ * @param first
+ * @param last
+ * @param step
+ */
+ public XAResourceIteratable(int first, int last, int step) {
+ this.first = first ;
+ this.last = last ;
+ this.step = step ;
+ this.random = true;
+ }
+
+ /**
+ * @param first
+ * @param last
+ * @param step
+ * @param fails
+ */
+ public XAResourceIteratable(int first, int last, int step, boolean
fails) {
+ this(first,last,step);
+ this.fails = fails;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator iterator() {
+ return new XAResourceIterator();
+ }
+
+ /**
+ * XA Resource Generator & Iterator implementation.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 4 août 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+ private class XAResourceIterator implements Iterator {
+ private final Map next = new HashMap();
+ private int counter = 0;
+ private boolean failure = fails;
+
+ /**
+ * Constructor
+ */
+ public XAResourceIterator() {
+ this.next.put(TransactionScenarioAbstract.XA_RESOURCES,new
ArrayList());
+ }
+
+ /**
+ * @return the list of XA resources.
+ */
+ private final List xa_res() {
+ return (List)
this.next.get(TransactionScenarioAbstract.XA_RESOURCES);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ return xa_res().size()<last;
+ }
+
+ /**
+ * @param fail
+ */
+ private void load(boolean fail) {
+ xa_res().clear();
+ for (int i=0 ; i<counter;i++)
+ xa_res().add(new CounterImpl(fail));
+ }
+
+ /**
+ * @return the failing flag to use.
+ */
+ private boolean fails() {
+ if (!random)
+ return failure;
+ if (counter%(SWITCH*step)==0)
+ this.failure = !this.failure;
+ return this.failure;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next() {
+ boolean fail = fails();
+ load(fail);
+ counter+=step;
+ System.out.println("[XA] Loading "+xa_res().size()+" XA
resources (fails="+fail+")...");
+ return this.next;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove() {
+ // empty body.
+ }
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/Counter.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/Counter.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/Counter.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,55 @@
+/*====================================================================
+
+ ObjectWeb GoTM project - http://gotm.objectweb.org
+ Contact: gotm@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): ______________________________________.
+
+ ---------------------------------------------------------------------
+ $Id: Counter.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.benchmark.jts.data;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 6 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="counter"
+ */
+public interface Counter {
+ /** Comment for <code>COUNTER</code>. */
+ public static final String COUNTER = "counter";
+
+ /**
+ * Initialize the counter value.
+ */
+ public void init();
+
+ /**
+ * Increment the value of the counter.
+ */
+ public void incr();
+
+ /**
+ * @return the value of the counter.
+ */
+ public int value();
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/CounterAttributes.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/CounterAttributes.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/CounterAttributes.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,53 @@
+/*====================================================================
+
+ ObjectWeb GoTM project - http://gotm.objectweb.org
+ Contact: gotm@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): ______________________________________.
+
+ ---------------------------------------------------------------------
+ $Id: CounterAttributes.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.benchmark.jts.data;
+
+import org.objectweb.fractal.api.control.AttributeController;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 6 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.controller name="attribute"
+ */
+public interface CounterAttributes
+ extends AttributeController
+{
+ /**
+ * @return the value of the counter.
+ */
+ public int getCounter() ;
+
+
+ /**
+ * Defines the value of the counter.
+ * @param value the value to set
+ */
+ public void setCounter(int value) ;
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/CounterImpl.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/CounterImpl.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/data/CounterImpl.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,239 @@
+/*====================================================================
+
+ ObjectWeb GoTM project - http://gotm.objectweb.org
+ Contact: gotm@xxxxxxxxxxxxx
+
+ This library 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 any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): ______________________________________.
+
+ ---------------------------------------------------------------------
+ $Id: CounterImpl.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.benchmark.jts.data;
+
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.objectweb.benchmark.jts.data.Counter;
+import org.objectweb.benchmark.jts.data.CounterAttributes;
+import org.objectweb.fractal.lib.LoggablePrimitive;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 3 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="synchronization" role="server"
signature="javax.transaction.Synchronization"
+ * @fractal.itf name="xa-resource" role="server"
signature="javax.transaction.xa.XAResource"
+ */
+public class CounterImpl
+ extends LoggablePrimitive
+ implements Synchronization,
+ XAResource,
+ Counter,
+ CounterAttributes
+{
+ /**
+ * @fractal.attr value="0"
+ */
+ private int counter ;
+
+ /** <code>clone</code> . */
+ private int clone ;
+
+ private boolean fails ;
+
+ /**
+ *
+ */
+ public CounterImpl() {
+ this(false);
+ }
+
+ /**
+ * @param fails
+ */
+ public CounterImpl(boolean fails) {
+ this.counter = this.clone = 0 ;
+ this.fails = fails;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.Synchronization#beforeCompletion()
+ */
+ public void beforeCompletion() {
+// getLogger().log(DEBUG,"Receiving beforeCompletion()...");
+// System.out.println("beforeCompletion");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.Synchronization#afterCompletion(int)
+ */
+ public void afterCompletion(int arg0) {
+// System.out.println("afterCompletion");
+// getLogger().log(DEBUG,"Receiving afterCompletion("+arg0+")...");
+// try {
+// Thread.sleep(1);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+ if (arg0 == Status.STATUS_COMMITTED) {
+ this.counter += this.clone ;
+ }
+ this.clone = 0 ;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.jts.local.Counter#init()
+ */
+ public void init() {
+ this.counter = this.clone = 0 ;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.jts.local.Counter#incr()
+ */
+ public void incr() {
+ this.clone++ ;
+// try {
+// Thread.sleep(10);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+ }
+
+ public String toString() {
+ return ""+this.counter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.jts.local.CounterAttributes#getCounter()
+ */
+ public int getCounter() {
+ return this.counter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.jts.local.CounterAttributes#setCounter(int)
+ */
+ public void setCounter(int value) {
+ this.counter = value ;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.jts.local.Counter#value()
+ */
+ public int value() {
+ return this.counter+this.clone;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid,
boolean)
+ */
+ public void commit(Xid arg0, boolean arg1) {
+// getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
+// System.out.println("commit");
+// try {
+// Thread.sleep(5);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+ this.counter += this.clone ;
+ this.clone=0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid,
int)
+ */
+ public void end(Xid arg0, int arg1) {
+// getLogger().log(DEBUG,"Receiving end("+arg0+", "+arg1+")");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
+ */
+ public void forget(Xid arg0) {
+// getLogger().log(DEBUG,"Receiving forget("+arg0+")");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#getTransactionTimeout()
+ */
+ public int getTransactionTimeout() {
+// getLogger().log(DEBUG,"Receiving getTransactionTimeout()");
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
+ */
+ public boolean isSameRM(XAResource arg0) {
+// getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
+ */
+ public int prepare(Xid arg0) throws XAException {
+ if (fails) throw new XAException();
+// getLogger().log(DEBUG,"Receiving prepare("+arg0+")");
+ return XA_OK;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#recover(int)
+ */
+ public Xid[] recover(int arg0) {
+// getLogger().log(DEBUG,"Receiving recover("+arg0+")");
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
+ */
+ public void rollback(Xid arg0) {
+// getLogger().log(DEBUG,"Receiving rollback("+arg0+")");
+// System.out.println("rollback");
+// try {
+// Thread.sleep(5);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+ this.clone = 0 ;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
+ */
+ public boolean setTransactionTimeout(int arg0) {
+// getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid,
int)
+ */
+ public void start(Xid arg0, int arg1) {
+// getLogger().log(DEBUG,"Receiving start("+arg0+", "+arg1+")");
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioAbstract.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioAbstract.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioAbstract.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,92 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: TransactionScenarioAbstract.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts.scenario;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.transaction.TransactionManager;
+
+import org.objectweb.benchmark.lib.ScenarioAbstract;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 18 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public abstract class TransactionScenarioAbstract
+extends ScenarioAbstract {
+
+ /** <code>SYNCHRONIZATIONS</code> . */
+ public static final String SYNCHRONIZATIONS = "sync-resources" ;
+ /** <code>XARESOURCES</code> . */
+ public static final String XA_RESOURCES = "xa-resources";
+ /** <code>TX_MANAGER</code> . */
+ public static final String TX_MANAGER = "transaction-manager";
+
+ protected TransactionManager tx_manager ;
+ protected List sync_res = new ArrayList();
+ protected List xa_res = new ArrayList();
+
+ /**
+ * @param n
+ *
+ */
+ public TransactionScenarioAbstract(String n) {
+ super(n);
+ }
+
+ /**
+ * @return the transaction manager benchmarked
+ */
+ public TransactionManager getTxManager() { return this.tx_manager; }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#setUp(java.util.Map)
+ */
+ public void updateConfiguration(Map config) {
+ if (config.get(SYNCHRONIZATIONS)!= null)
+ sync_res = (List) config.get(SYNCHRONIZATIONS);
+ if (config.get(XA_RESOURCES) != null)
+ xa_res = (List) config.get(XA_RESOURCES);
+ if (config.get(TX_MANAGER) != null)
+ tx_manager = (TransactionManager) config.get(TX_MANAGER);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.ScenarioAbstract#check()
+ */
+ public void check(){
+ if (tx_manager == null )
+ Logger.getLogger(name).severe("No "+TX_MANAGER+" property was
defined!");
+ }
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioCommit.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioCommit.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioCommit.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,68 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: TransactionScenarioCommit.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts.scenario;
+
+import java.util.Iterator;
+
+import javax.transaction.Synchronization;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 18 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class TransactionScenarioCommit
+ extends TransactionScenarioAbstract {
+
+ /**
+ * @param name
+ */
+ public TransactionScenarioCommit(String name) {
+ super(name);
+ }
+
+ /**
+ */
+ public TransactionScenarioCommit() {
+ this("commit");
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.TransactionScenarioAbstract#execute()
+ */
+ public void execute() throws Exception {
+ start();
+ tx_manager.begin();
+ for (Iterator i = sync_res.iterator() ; i.hasNext();)
+
tx_manager.getTransaction().registerSynchronization((Synchronization)i.next());
+ tx_manager.commit();
+ stop();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioRollback.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioRollback.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioRollback.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,68 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: TransactionScenarioRollback.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts.scenario;
+
+import java.util.Iterator;
+
+import javax.transaction.Synchronization;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 18 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class TransactionScenarioRollback
+ extends TransactionScenarioAbstract {
+
+ /**
+ * @param name
+ */
+ public TransactionScenarioRollback(String name) {
+ super(name);
+ }
+
+ /**
+ */
+ public TransactionScenarioRollback() {
+ this("rollback");
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.TransactionScenarioAbstract#execute()
+ */
+ public void execute() throws Exception {
+ start();
+ tx_manager.begin();
+ for (Iterator i = sync_res.iterator() ; i.hasNext();)
+
tx_manager.getTransaction().registerSynchronization((Synchronization)i.next());
+ tx_manager.rollback();
+ stop();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXACommit.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXACommit.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXACommit.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,72 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: TransactionScenarioXACommit.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.jts.scenario;
+
+import java.util.Iterator;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 18 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class TransactionScenarioXACommit
+ extends TransactionScenarioAbstract {
+
+ /**
+ * @param name
+ */
+ public TransactionScenarioXACommit(String name) {
+ super(name);
+ }
+
+ /**
+ */
+ public TransactionScenarioXACommit() {
+ this("commit(XA)");
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.TransactionScenarioAbstract#execute()
+ */
+ public void execute() throws Exception {
+ tx_manager.begin();
+ for (Iterator i = xa_res.iterator() ; i.hasNext();)
+ tx_manager.getTransaction().enlistResource((XAResource)i.next());
+ start();
+ try {
+ tx_manager.commit();
+ } catch (Exception ex) {
+ // ignored...
+ }
+ stop();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXARollback.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXARollback.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/jts/scenario/TransactionScenarioXARollback.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,68 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: TransactionScenarioXARollback.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp
$
+====================================================================*/
+package org.objectweb.benchmark.jts.scenario;
+
+import java.util.Iterator;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 18 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class TransactionScenarioXARollback
+ extends TransactionScenarioAbstract {
+
+ /**
+ * @param name
+ */
+ public TransactionScenarioXARollback(String name) {
+ super(name);
+ }
+
+ /**
+ */
+ public TransactionScenarioXARollback() {
+ this("rollback(XA)");
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.TransactionScenarioAbstract#execute()
+ */
+ public void execute() throws Exception {
+ tx_manager.begin();
+ for (Iterator i = xa_res.iterator() ; i.hasNext();)
+ tx_manager.getTransaction().enlistResource((XAResource)i.next());
+ start();
+ tx_manager.rollback();
+ stop();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/Benchmark.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/Benchmark.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/Benchmark.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,98 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Benchmark.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Outcome;
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.api.Visitor;
+import org.objectweb.benchmark.lib.visitor.VisitorConcat;
+
+/**
+ * Wrapper to execute a delegate iteration times.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="delegate" role="client"
signature="org.objectweb.benchmark.api.Scenario"
+ * @fractal.itf name="visitor" role="client" contigency="optional"
signature="org.objectweb.benchmark.api.Visitor"
+ */
+public class Benchmark implements Scenario {
+
+ /** <code>WARM_UP</code> . */
+ public static final String WARM_UP = "warm-up";
+ /** <code>ITERATION</code> . */
+ public static final String ITERATION = "iteration";
+
+ /** <code>delegate</code> to execute. */
+ private final Scenario delegate ;
+ /** <code>visitor</code> . */
+ private final Visitor visitor ;
+ /** number of benchmark <code>warm_up</code>. */
+ private final int warm_up;
+ /** number of benchmark <code>iteration</code>. */
+ private final int iteration;
+
+ /**
+ * @param s the delegate to execute.
+ * @param v the visitor to execute.
+ * @param warm number of warm up to execute.
+ * @param iter number of iterations to execute.
+ */
+ public Benchmark(Scenario s, Visitor v, int warm, int iter) {
+ this.delegate = s;
+ this.visitor = v;
+ this.warm_up = warm;
+ this.iteration = iter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#setUp(java.util.Map)
+ */
+ public void updateConfiguration(Map config) {
+ this.delegate.updateConfiguration(config);
+ }
+
+ public Outcome run() throws Exception {
+ System.out.println("Executing the "+this+" scenario...");
+ Visitor concat = new VisitorConcat();
+ concat.init();
+ for (int i=0; i<warm_up ; i++)
+ this.delegate.run();
+ for (int i=0; i<iteration ; i++)
+ this.delegate.run().accept(concat);
+ this.visitor.init();
+ concat.compute().accept(this.visitor);
+ return this.visitor.compute();
+ }
+
+ public String toString() {
+ return this.delegate+"["+warm_up+","+iteration+"]";
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ConfigurationIterator.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ConfigurationIterator.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ConfigurationIterator.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,93 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: ConfigurationIterator.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Outcome;
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.api.Visitor;
+import org.objectweb.benchmark.lib.visitor.VisitorConcat;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="delegate" role="client"
signature="org.objectweb.benchmark.api.Scenario"
+ * @fractal.itf name="visitor" role="client" contigency="optional"
signature="org.objectweb.benchmark.api.Visitor"
+ * @fractal.itf name="iterator" role="client" contigency="optional"
signature="java.lang.Iterable"
+ */
+public class ConfigurationIterator
+ implements Scenario {
+ /** <code>delegate</code> scenario. */
+ private final Scenario delegate ;
+ /** <code>visitor</code> . */
+ private final Visitor visitor;
+ /** <code>iterable</code> . */
+ private final Iterable iterable ;
+
+ /**
+ * @param scenario
+ * @param iterable
+ */
+ public ConfigurationIterator(Scenario scenario, Iterable iterable) {
+ this(scenario,iterable,new VisitorConcat());
+ }
+
+ /**
+ * @param scenario
+ * @param iterable
+ * @param update
+ */
+ public ConfigurationIterator(Scenario scenario, Iterable iterable,
Visitor update) {
+ this.delegate = scenario;
+ this.iterable = iterable;
+ this.visitor = update;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#setUp(java.util.Map)
+ */
+ public void updateConfiguration(Map config) {
+ this.delegate.updateConfiguration(config);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#run()
+ */
+ public Outcome run() throws Exception{
+ this.visitor.init();
+ for (Iterator i = iterable.iterator(); i.hasNext();) {
+ this.delegate.updateConfiguration((Map)i.next());
+ this.delegate.run().accept(this.visitor);
+ }
+ return this.visitor.compute();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/OutcomeImpl.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/OutcomeImpl.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/OutcomeImpl.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,96 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: OutcomeImpl.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Outcome;
+import org.objectweb.benchmark.api.Visitor;
+
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ */
+public class OutcomeImpl implements Outcome {
+ private Map values = new HashMap();
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Outcome#values(java.lang.String)
+ */
+ public List values(String name) {
+ List val = (List) values.get(name);
+ if (val == null) {
+ val = new ArrayList();
+ values.put(name, val);
+ }
+ return val;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Outcome#names()
+ */
+ public String[] names() {
+ return (String[]) values.keySet().toArray(new String[0]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Outcome#store(java.lang.String,
java.lang.Number)
+ */
+ public void store(String name, Number value) {
+ values(name).add(value);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.benchmark.api.Outcome#accept(org.objectweb.benchmark.api.Visitor)
+ */
+ public void accept(Visitor visitor) {
+ for (Iterator i=this.values.keySet().iterator();i.hasNext();) {
+ String name = (String) i.next();
+ visitor.visit(name, values(name));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator i=this.values.keySet().iterator();i.hasNext();) {
+ String name = (String) i.next();
+ buffer.append("("+name+"="+values(name)+")");
+ }
+ return buffer.toString();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/RandomScenario.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/RandomScenario.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/RandomScenario.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,78 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: RandomScenario.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+import java.util.List;
+
+import org.objectweb.benchmark.api.Outcome;
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.api.Visitor;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 3 août 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class RandomScenario
+ extends ScenarioIterator {
+ /**
+ * @param scenarios
+ */
+ public RandomScenario(Scenario[] scenarios) {
+ super(scenarios);
+ }
+
+ /**
+ * @param scenarios
+ * @param visitor
+ */
+ public RandomScenario(Scenario[] scenarios, Visitor visitor) {
+ super(scenarios,visitor);
+ }
+
+ /**
+ * @param scenarios
+ * @param visitor
+ */
+ public RandomScenario(List scenarios, Visitor visitor) {
+ super(scenarios,visitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#run()
+ */
+ public Outcome run() throws Exception {
+ this.visitor.init();
+ int nb = (int) System.currentTimeMillis() % this.scenarios.size();
+ Scenario s = (Scenario) this.scenarios.get(nb);
+ s.run().accept(this.visitor);
+ return this.visitor.compute();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ScenarioAbstract.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ScenarioAbstract.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ScenarioAbstract.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,123 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: ScenarioAbstract.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Outcome;
+import org.objectweb.benchmark.api.Scenario;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public abstract class ScenarioAbstract
+ implements Scenario {
+
+ /** <code>name</code> description of the scenario. */
+ protected final String name;
+
+ /** <code>timer</code> used to take times.*/
+ private Timer timer;
+
+ /** <code>results</code> used to store times. */
+ protected Outcome results;
+
+ /**
+ * @param desc name of the scenario (times are stored under this name).
+ */
+ public ScenarioAbstract(String desc) {
+ this.name = desc ;
+ }
+
+ /**
+ * Starts the timer.
+ */
+ protected void start() {
+ this.timer.start();
+ }
+
+ /**
+ * Stops the timer and stores the results.
+ */
+ protected void stop() {
+ this.timer.stop();
+ if (this.results != null)
+ this.results.store(this.name,this.timer.display());
+ }
+
+ /**
+ * Stops the timer and stores the results.
+ * @param suffix suffix to add as identifier.
+ */
+ protected void stop(String suffix) {
+ this.timer.stop();
+ if (this.results != null)
+ this.results.store(this.name+"."+suffix,this.timer.display());
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#setUp(java.util.Map)
+ */
+ public void updateConfiguration(Map config) {
+ // empty by default
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#run()
+ */
+ public Outcome run() throws Exception {
+ check();
+ this.timer = new Timer();
+ this.results = new OutcomeImpl();
+ execute();
+ return this.results;
+ }
+
+ /**
+ * checks if parameters are correct.
+ */
+ protected void check() {
+ // empty by default.
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return this.name;
+ }
+
+ /**
+ * @throws Exception
+ */
+ public abstract void execute() throws Exception ;
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ScenarioIterator.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ScenarioIterator.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/ScenarioIterator.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,101 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: ScenarioIterator.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.benchmark.api.Outcome;
+import org.objectweb.benchmark.api.Scenario;
+import org.objectweb.benchmark.api.Visitor;
+import org.objectweb.benchmark.lib.visitor.VisitorConcat;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class ScenarioIterator
+ implements Scenario {
+
+ /** <code>scenarios</code>: list of scenarios to execute. */
+ protected final List scenarios;
+ /** <code>visitor</code>: treatment to apply when iterating. */
+ protected final Visitor visitor;
+
+ /**
+ * @param scenarios
+ */
+ public ScenarioIterator(Scenario[] scenarios) {
+ this(scenarios, new VisitorConcat());
+ }
+
+ /**
+ * @param scenarios
+ * @param visitor
+ */
+ public ScenarioIterator(Scenario[] scenarios, Visitor visitor) {
+ this.scenarios = Arrays.asList(scenarios);
+ this.visitor = visitor;
+ }
+
+ /**
+ * @param scenarios
+ * @param visitor
+ */
+ public ScenarioIterator(List scenarios, Visitor visitor) {
+ this.scenarios = scenarios;
+ this.visitor = visitor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.benchmark.api.Scenario#setUp(java.util.Map)
+ */
+ public void updateConfiguration(Map config) {
+ for (Iterator i = this.scenarios.iterator();i.hasNext();) {
+ Scenario s = (Scenario) i.next();
+ s.updateConfiguration(config);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.benchmark.api.Scenario#run(org.objectweb.benchmark.api.BenchmarkResult)
+ */
+ public Outcome run() throws Exception {
+ this.visitor.init();
+ for (Iterator i = this.scenarios.iterator();i.hasNext();) {
+ Scenario s = (Scenario) i.next();
+ s.run().accept(this.visitor);
+ }
+ return this.visitor.compute();
+ }
+}
\ No newline at end of file
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/Timer.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/Timer.java:1.1
--- /dev/null Mon Aug 8 15:29:03 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/Timer.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,74 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Timer.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 11 janv. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ */
+public class Timer {
+
+ private long time = 0;
+ private boolean progress = false;
+
+
+ /**
+ * Starts the timer.
+ */
+ public void start() {
+ this.time = System.currentTimeMillis() ;
+ this.progress = true ;
+ }
+
+ /**
+ * Stops the timer.
+ */
+ public void stop() {
+ this.time = System.currentTimeMillis() - this.time ;
+ this.progress = false ;
+ }
+
+ /**
+ * Display the value of the timer.
+ * @return the elapsed time in milliseconds.
+ */
+ public Long display() {
+ if (this.progress)
+ throw new RuntimeException("Timer is in progress");
+ return new Long(this.time);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return this.display() + " ms";
+ }
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/visitor/Rename.java
diff -u /dev/null
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/visitor/Rename.java:1.1
--- /dev/null Mon Aug 8 15:29:04 2005
+++
gotm-jts/examples/benchmark/src/java/org/objectweb/benchmark/lib/visitor/Rename.java
Mon Aug 8 15:29:02 2005
@@ -0,0 +1,44 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library 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 any later version.
+
+This library 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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Rename.java,v 1.1 2005/08/08 13:29:02 rouvoy Exp $
+====================================================================*/
+package org.objectweb.benchmark.lib.visitor;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 19 juil. 2005
+ * @modified $Date: 2005/08/08 13:29:02 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public interface Rename {
+ /**
+ * rename the original name.
+ * @param original original name.
+ * @return the new name.
+ */
+ String rename(String original);
+}
Index:
gotm-jts/examples/benchmark/src/java/org/objectweb/