OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | gotm-commits List | December 2005 Index

<--  Date Index  --> <--  Thread Index  -->

CVS update of gotm-jts (5 files)


    Date: Tuesday, December 20, 2005 @ 16:43:30
  Author: rouvoy
    Path: /cvsroot/gotm/gotm-jts

   Added: examples/profile/.cvsignore examples/profile/build.xml
          
examples/profile/src/java/org/objectweb/gotm/jts/profile/GoTMProfile.java
Modified: .classpath examples/benchmark/build.xml

* Applying optimizations to limit garbage collecting,
* Adding a new profile example in jts personality that use the JVM profiler 
tool.


---------------------------------------------------------------------------+
 .classpath                                                                |  
  1 
 examples/benchmark/build.xml                                              |  
  3 
 examples/profile/.cvsignore                                               |  
  2 
 examples/profile/build.xml                                                |  
 84 ++++++
 examples/profile/src/java/org/objectweb/gotm/jts/profile/GoTMProfile.java |  
128 ++++++++++
 5 files changed, 216 insertions(+), 2 deletions(-)


Index: gotm-jts/.classpath
diff -u gotm-jts/.classpath:1.16 gotm-jts/.classpath:1.17
--- gotm-jts/.classpath:1.16    Fri Dec 16 17:03:29 2005
+++ gotm-jts/.classpath Tue Dec 20 16:43:30 2005
@@ -21,5 +21,6 @@
        <classpathentry kind="lib" 
path="/fractal-import/lib/fractal-explorer/fractal-explorer.jar"/>
        <classpathentry kind="lib" path="lib/jta/jta-1_01.jar"/>
        <classpathentry kind="lib" 
path="/fractal-import/lib/aokell/aokell-lib.jar"/>
+       <classpathentry kind="src" path="examples/profile/src/java"/>
        <classpathentry kind="output" path="output/eclipse"/>
 </classpath>
Index: gotm-jts/examples/benchmark/build.xml
diff -u gotm-jts/examples/benchmark/build.xml:1.8 
gotm-jts/examples/benchmark/build.xml:1.9
--- gotm-jts/examples/benchmark/build.xml:1.8   Mon Dec 19 17:13:44 2005
+++ gotm-jts/examples/benchmark/build.xml       Tue Dec 20 16:43:30 2005
@@ -21,7 +21,7 @@
 <!-- Initial developer(s): Romain Rouvoy.                                 -->
 <!-- Contributor(s): ______________________________________.              -->
 
-<!-- $Id: build.xml,v 1.8 2005/12/19 16:13:44 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.9 2005/12/20 15:43:30 rouvoy Exp $ -->
 <!-- ==================================================================== -->
 
 <project name="JTS Benchmark" default="all">
@@ -40,7 +40,6 @@
   <!-- ================ -->
   <path id="classpath">
     <fileset dir="${build.dir}/${lib.dir}" includes="**/*.jar"/>
-       <fileset dir="/home/rouvoy/arjuna/ats4.0/lib" includes="**/*.jar"/>
   </path>
 
   <!-- ================== -->
Index: gotm-jts/examples/profile/.cvsignore
diff -u /dev/null gotm-jts/examples/profile/.cvsignore:1.1
--- /dev/null   Tue Dec 20 16:43:30 2005
+++ gotm-jts/examples/profile/.cvsignore        Tue Dec 20 16:43:30 2005
@@ -0,0 +1,2 @@
+output
+log.txt
Index: gotm-jts/examples/profile/build.xml
diff -u /dev/null gotm-jts/examples/profile/build.xml:1.1
--- /dev/null   Tue Dec 20 16:43:30 2005
+++ gotm-jts/examples/profile/build.xml Tue Dec 20 16:43:30 2005
@@ -0,0 +1,84 @@
+<!-- ==================================================================== -->
+
+<!-- ObjectWeb GoTM is an open Tx Monitor Project                         -->
+<!-- Contact: http://www.objectweb.org                                    -->
+
+<!-- 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: build.xml,v 1.1 2005/12/20 15:43:30 rouvoy Exp $ -->
+<!-- ==================================================================== -->
+
+<project name="JTS Profile" default="all">
+  <description>GoTM JTS Profile [gotm.objectweb.org] - GoTM is an open 
Transaction Monitor</description>
+
+  <!-- ==================== -->
+  <!-- PROPERTY DEFINITIONS -->
+  <!-- ==================== -->
+  <import file="${basedir}/../../../fractal-import/build.xml"/>
+  <property name="examples.jar"     value="ow-gotm-jts-profile.jar"/>
+  <property name="examples.version" value="0.1a"/>
+  <property name="dist.name"        value="GoTM-JTS-Profile"/>
+
+  <!-- ================ -->
+  <!-- PATH DEFINITIONS -->
+  <!-- ================ -->
+  <path id="classpath">
+    <fileset dir="${build.dir}/${lib.dir}" includes="**/*.jar"/>
+  </path>
+
+  <!-- ================== -->
+  <!-- TARGET DEFINITIONS -->
+  <!-- ================== -->
+  <target name="all" description="clean + execute">
+    <antcall target="clean"/>
+    <antcall target="execute"/>
+  </target>
+
+  <target name="profile-compile" depends="-gotm.jts">
+    <fractalc javadir="${build.gen}" fractaldir="${build.cls}">
+      <javaset>
+        <fileset dir="${basedir}/${src.java}" includes="**/*.java" />
+        <fileset dir="${build.gen}" includes="**/*.java" />
+      </javaset>
+    </fractalc>
+    <copy todir="${build.cls}" failonerror="no">
+      <fileset dir="${basedir}/${src.frac}" excludes="**/*.java"/>
+    </copy>
+    <copy todir="${build.cls}" failonerror="no">
+      <fileset dir="${basedir}/src" includes="**/*.properties"/>
+    </copy>
+    <javar destfile="${build.lib}/${examples.jar}"
+           javadir="${basedir}/${src.java}:${build.gen}" 
+           classdir="${build.cls}" libraries="classpath"/>
+  </target>
+
+  <target name="import" depends="profile-compile,clear" unless="imported"/>
+  
+  <target name="execute" depends="import"
+   description="profiles GoTM">
+    <java classname="org.objectweb.gotm.jts.profile.GoTMProfile"
+       classpathref="classpath"
+               fork="yes"
+        failonerror="yes">
+<!--      <jvmarg value="-Xrunhprof:cpu=samples,file=log.txt,depth=3"/>-->
+      <jvmarg value="-Xprof"/>
+      <sysproperty key="fractal.provider" value="aokell.AOKell"/>
+    </java>
+  </target>
+</project>
\ No newline at end of file
Index: 
gotm-jts/examples/profile/src/java/org/objectweb/gotm/jts/profile/GoTMProfile.java
diff -u /dev/null 
gotm-jts/examples/profile/src/java/org/objectweb/gotm/jts/profile/GoTMProfile.java:1.1
--- /dev/null   Tue Dec 20 16:43:30 2005
+++ 
gotm-jts/examples/profile/src/java/org/objectweb/gotm/jts/profile/GoTMProfile.java
  Tue Dec 20 16:43:30 2005
@@ -0,0 +1,128 @@
+/*==============================================================================
+GoTM - Copyright (C) 2000-2006 INRIA & USTL - LIFL - GOAL
+GoTM is an open Transaction Monitor (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 (romain.rouvoy@xxxxxxx)
+Contributor(s): .
+--------------------------------------------------------------------------------
+$Id: GoTMProfile.java,v 1.1 2005/12/20 15:43:30 rouvoy Exp $
+==============================================================================*/
+package org.objectweb.gotm.jts.profile;
+
+import java.util.HashMap;
+
+import javax.transaction.Synchronization;
+import javax.transaction.TransactionManager;
+
+import org.objectweb.gotm.lib.JtsFactory;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
+ * @version $Revision: 1.1 $
+ */
+public class GoTMProfile {
+    /** <code>NB_SYNCHRONIZATION</code> enlisted. */
+    public static final int NB_SYNCHRONIZATION = 50 ;
+    /** <code>ITERATIONS</code> applied on scenario. */
+    public static final int ITERATIONS = 200;
+    
+    int before = 0;
+    int after=0;
+
+    private class Sync implements Synchronization {
+        public void beforeCompletion() {
+            before++;
+        }
+
+        public void afterCompletion(int arg0) {
+            after++;
+        }
+    }
+    
+    /**
+     * Profiles a commit scenario.
+     * @param tm the transaction manager used.
+     * @throws Exception thrown if scenario fails.
+     */
+    public void runCommit(TransactionManager tm) throws Exception{
+        tm.begin();
+        for (int i=NB_SYNCHRONIZATION;i>0;i--)
+            tm.getTransaction().registerSynchronization(new Sync());
+        tm.commit();
+    }
+    
+    /**
+     * Profiles an abort scenario.
+     * @param tm the transaction manager used.
+     * @throws Exception thrown if scenario fails.
+     */
+    public void runAbort(TransactionManager tm) throws Exception{
+        tm.begin();
+        for (int i=NB_SYNCHRONIZATION;i>0;i--)
+            tm.getTransaction().registerSynchronization(new Sync());
+        tm.rollback();
+    }
+    
+    /**
+     * Profiles a mark rollback scenario.
+     * @param tm the transaction manager used.
+     * @throws Exception thrown if scenario fails.
+     */
+    public void runMark(TransactionManager tm) throws Exception{
+        tm.begin();
+        for (int i=NB_SYNCHRONIZATION;i>0;i--)
+            tm.getTransaction().registerSynchronization(new Sync());
+        tm.setRollbackOnly();
+        tm.commit();
+    }
+    /**
+     * @param args
+     */
+    public static void main(String[] args){
+        TransactionManager tm = null;
+        try {
+            
System.getProperties().put("gotm-2pc-participant","org.objectweb.gotm.lib.protocol.participant.Fc2PCNoLog");
+            
System.getProperties().put("gotm-protocol","org.objectweb.gotm.lib.protocol.coordinator.Fc2PCNoLog");
+            
System.getProperties().put("gotm-communication","org.objectweb.gotm.lib.message.FcEventBusSimple");
+            HashMap ctx = new HashMap() ;
+            
ctx.put("factory","org.objectweb.gotm.lib.factory.FcTransactionFactoryObservable");
+            tm = JtsFactory.create(ctx);
+        } catch (Exception e) {
+            System.err.println("[GoTM] Initialization failed: 
"+e.getMessage());
+        }
+        GoTMProfile profile= new GoTMProfile();
+        for (int i=ITERATIONS;i>0;i--)
+            try {
+                profile.runCommit(tm);
+            } catch (Exception e) {
+                System.err.println("[Profile] runCommit(): "+e.getMessage());
+            }
+        for (int i=ITERATIONS;i>0;i--)
+            try {
+                profile.runAbort(tm);
+            } catch (Exception e) {
+                System.err.println("[Profile] runAbort(): "+e.getMessage());
+            }
+        for (int i=ITERATIONS;i>0;i--)
+            try {
+                profile.runMark(tm);
+            } catch (Exception e) {
+                // ignored
+            } 
+            
System.out.println("[SYNC][before="+profile.before+"][after="+profile.after+"]");
+            System.out.println("[Profile] Done.");
+            System.exit(0);
+    }
+}



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.