Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
authorJulien Gossa <julien.gossa@unistra.fr>
Fri, 4 Mar 2016 17:08:01 +0000 (18:08 +0100)
committerJulien Gossa <julien.gossa@unistra.fr>
Fri, 4 Mar 2016 17:08:01 +0000 (18:08 +0100)
I AM THE KING OF THE BINDINGS! FEAR MY POWER!
(and no test has been armed during these commits... Just some cleaning...)

ChangeLog.SimGrid-java
examples/java/cloud/migration/XVM.java
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jmsg_vm.h
src/bindings/java/org/simgrid/msg/VM.java

index d66e6b7..5500d4f 100644 (file)
@@ -1,5 +1,11 @@
 ChangeLog for SimGrid-java, before its integration into the main source tree.
 
+SimGrid (3.13) UNRELEASED; urgency=low
+
+ Backwards Compatibility breaks
+   - VM.setBound(int load) is now VM.setBound(double bound) to meet the MSG semantics. Use VM.getSpeed()*load/100 for the legacy behavior.
+
+
 SimGrid-java (3.9) stable; urgency=low
 
  -- 2013-01-30 Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
index f34da08..b62529e 100644 (file)
@@ -32,7 +32,7 @@ public class XVM extends VM {
 
   public void setLoad(int load){  
     if (load >0) {
-      this.setBound(load);
+      this.setBound(this.getSpeed()*load/100);
       //    this.getDaemon().setLoad(load);
       daemon.resume();
     } else{
index 3eb6c15..60c6609 100644 (file)
@@ -77,11 +77,10 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv * env, jobject jvm) {
 }
 
 JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jint load) { 
+Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jdouble bound) { 
 
   msg_vm_t vm = jvm_get_native(env,jvm);
-  double bound = MSG_get_host_speed(vm) * load / 100;
-  MSG_vm_set_bound(vm, bound); 
+  MSG_vm_set_bound(vm, bound);
 }
 
 JNIEXPORT void JNICALL
@@ -158,46 +157,3 @@ Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   MSG_vm_restore(vm);
 }
-
-
-
-JNIEXPORT jobject JNICALL
-Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) {
-  jobject jhost;
-  msg_vm_t vm = jvm_get_native(env,jvm);
-  msg_host_t host = MSG_vm_get_pm(vm);
-
-  if (!host->extension(JAVA_HOST_LEVEL)) {
-    THROW_DEADCODE;
-    /* the native host not yet associated with the java host instance */
-
-    /* instanciate a new java host instance */
-    jhost = jhost_new_instance(env);
-
-    if (!jhost) {
-      jxbt_throw_jni(env, "java host instantiation failed");
-      return NULL;
-    }
-
-    /* get a global reference to the newly created host */
-    jhost = jhost_ref(env, jhost);
-
-    if (!jhost) {
-      jxbt_throw_jni(env, "global ref allocation failed");
-      return NULL;
-    }
-    /* Sets the host name */
-    const char *name = MSG_host_get_name(host);
-    jobject jname = env->NewStringUTF(name);
-    env->SetObjectField(jhost, jxbt_get_jfield(env,
-      env->FindClass("org/simgrid/msg/Host"), "name", "Ljava/lang/String;"),
-      jname);
-    /* Bind & store it */
-    jhost_bind(jhost, host, env);
-    host->extension_set(JAVA_HOST_LEVEL, (void *) jhost);
-  } else {
-    jhost = (jobject) host->extension(JAVA_HOST_LEVEL);
-  }
-
-  return jhost;
-}
index 1ed5e3b..12de5fd 100644 (file)
@@ -84,10 +84,10 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv *env, jobject jvm);
 /**
  * Class      org_simgrid_msg_VM
  * Method      setBound
- * Signature  ()B
+ * Signature  (D)B
  */
 JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jint load); 
+Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jdouble bound); 
 
 /**
  * Class            org_simgrid_msg_VM
@@ -149,15 +149,12 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm);
 /**
  * Class            org_simgrid_msg_VM
- * Method           save
+ * Method           restore
  * Signature    ()V
  */
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm);
 
-JNIEXPORT jobject JNICALL
-Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm);
-
 SG_END_DECL()
 
 #endif
index 77cdaee..6752b0b 100644 (file)
@@ -131,10 +131,10 @@ public class VM extends Host{
 
 
        /**
-        * Bound the VM to a certain % of its vcpu capability (e.g. 75% of vm.getSpeed())
-        * @param load percentage (between [0,100]
+        * Set a CPU bound for a given VM.
+        * @param bound in flops/s
         */
-       public native void setBound(int load);
+       public native void setBound(double bound);
 
        /**
         * start the VM