Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / bindings / java / jmsg_vm.cpp
index a5be2cc..60c6609 100644 (file)
@@ -29,7 +29,7 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_nativeInit(JNIEnv *env, jclass cls) {
   jclass jprocess_class_VM = env->FindClass("org/simgrid/msg/VM");
   jvm_field_bind = jxbt_get_jfield(env, jprocess_class_VM, "bind", "J");
-  if (!jvm_field_bind  ) {
+  if (!jvm_field_bind  ) {
     jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
   }
 }
@@ -77,16 +77,15 @@ 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_t vm = jvm_get_native(env,jvm);
+  MSG_vm_set_bound(vm, bound);
 }
 
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
-                              jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize, jint jmig_netspeed, jint jdp_intensity) {
+                   jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize, jint jmig_netspeed, jint jdp_intensity) {
 
   msg_host_t host = jhost_get_native(env, jhost);
 
@@ -100,7 +99,7 @@ Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring
   // disk_path = xbt_strdup(disk_path);
 
   msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (int) jramsize,
-                 (int) jnetcap, NULL, (int) jdisksize, (int) jmig_netspeed, (int) jdp_intensity);
+      (int) jnetcap, NULL, (int) jdisksize, (int) jmig_netspeed, (int) jdp_intensity);
 
   jvm_bind(env,jvm,vm);
 }
@@ -131,7 +130,7 @@ Java_org_simgrid_msg_VM_internalmig(JNIEnv *env, jobject jvm, jobject jhost) {
   TRY{
   MSG_vm_migrate(vm,host);
   } CATCH(e){
-     XBT_INFO("CATCH EXCEPTION MIGRATION %s",e.msg);
+     XBT_VERB("CATCH EXCEPTION MIGRATION %s",e.msg);
      xbt_ex_free(e);
      jxbt_throw_host_failure(env, (char*)"during migration");
   } 
@@ -158,45 +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 (!xbt_lib_get_level(host, JAVA_HOST_LEVEL)) {
-    /* 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);
-    xbt_lib_set(host_lib, host->key, JAVA_HOST_LEVEL, (void *) jhost);
-  } else {
-    jhost = (jobject) xbt_lib_get_level(host, JAVA_HOST_LEVEL);
-  }
-
-  return jhost;
-}