Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
getMessageSize
authorJonathan Rouzaud-Cornabas <jonathan.rouzaud-cornabas@ens-lyon.fr>
Thu, 29 Nov 2012 11:40:52 +0000 (05:40 -0600)
committerJonathan Rouzaud-Cornabas <jonathan.rouzaud-cornabas@ens-lyon.fr>
Thu, 29 Nov 2012 11:40:52 +0000 (05:40 -0600)
org/simgrid/msg/Task.java
src/jtrace.c

index 84eaf88..e5e5fbf 100644 (file)
@@ -26,9 +26,18 @@ public class Task {
         */
        protected String name;
 
         */
        protected String name;
 
+       private double messageSize;
+
+       static private Long idCpt = 0L;
+
+       private Long id;
+
        /** Default constructor (all fields to 0 or null) */
        public Task() {
                create(null, 0, 0);
        /** Default constructor (all fields to 0 or null) */
        public Task() {
                create(null, 0, 0);
+               this.messageSize = 0;
+               setId(idCpt);
+               idCpt++;
        }
 
        /* *              * *
        }
 
        /* *              * *
@@ -50,6 +59,9 @@ public class Task {
         */ 
        public Task(String name, double computeDuration, double messageSize) {
                create(name, computeDuration, messageSize);
         */ 
        public Task(String name, double computeDuration, double messageSize) {
                create(name, computeDuration, messageSize);
+               this.messageSize = messageSize;
+               setId(idCpt);
+               idCpt++;
        }
        /**
         * Construct an new parallel task with the specified processing amount and amount for each host
        }
        /**
         * Construct an new parallel task with the specified processing amount and amount for each host
@@ -77,7 +89,7 @@ public class Task {
         *                        methods. This value has to be >= 0.
         * @exception             IllegalArgumentException if compute duration <0 or message size <0
         */
         *                        methods. This value has to be >= 0.
         * @exception             IllegalArgumentException if compute duration <0 or message size <0
         */
-       final native void create(String name,
+       private final native void create(String name,
                        double computeDuration,
                        double messageSize)
        throws IllegalArgumentException;                
                        double computeDuration,
                        double messageSize)
        throws IllegalArgumentException;                
@@ -91,7 +103,7 @@ public class Task {
         * @param messageSizes        An array of doubles
         *
         */
         * @param messageSizes        An array of doubles
         *
         */
-       final native void parallelCreate(String name,
+       private final native void parallelCreate(String name,
                        Host[]hosts,
                        double[]computeDurations,
                        double[]messageSizes)
                        Host[]hosts,
                        double[]computeDurations,
                        double[]messageSizes)
@@ -279,4 +291,16 @@ public class Task {
        static {
                nativeInit();
        }
        static {
                nativeInit();
        }
+
+       public double getMessageSize() {
+               return this.messageSize;
+       }
+
+       public Long getId() {
+               return id;
+       }
+
+       public void setId(Long id) {
+               this.id = id;
+       }
 }
 }
index cf17157..1a3559b 100644 (file)
@@ -134,3 +134,15 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_vmVariableSet
   (*env)->ReleaseStringUTFChars(env, js_vm, vm);
   (*env)->ReleaseStringUTFChars(env, js_state, state);
 }
   (*env)->ReleaseStringUTFChars(env, js_vm, vm);
   (*env)->ReleaseStringUTFChars(env, js_state, state);
 }
+
+JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableAdd
+  (JNIEnv *env, jclass cls, jstring js_host, jstring js_state, jdouble value) {
+
+  const char *host = (*env)->GetStringUTFChars(env, js_host, 0);
+  const char *state = (*env)->GetStringUTFChars(env, js_state, 0);
+
+  TRACE_host_variable_set(host, state, value);
+
+  (*env)->ReleaseStringUTFChars(env, js_host, host);
+  (*env)->ReleaseStringUTFChars(env, js_state, state);
+}