Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No vm when ptask on
[simgrid.git] / src / bindings / java / jmsg_vm.c
index b19223a..2df6a93 100644 (file)
@@ -1,9 +1,10 @@
 /* Functions related to the MSG VM API. */
 
-/* Copyright (c) 2012. The SimGrid Team. */
+/* Copyright (c) 2012-2013. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 * under the terms of the license (GNU LGPL) which comes with this package. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
 #include "jmsg_vm.h"
 #include "jmsg_host.h"
 #include "jmsg_process.h"
@@ -70,9 +71,18 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv * env, jobject jvm) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   return (jint) MSG_vm_is_restoring(vm);
 }
+
+JNIEXPORT void JNICALL
+Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jint load) { 
+
+       msg_vm_t vm = jvm_get_native(env,jvm);
+       double bound = MSG_get_host_speed(vm) * load / 100;
+       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, jlong jramsize, jlong jnetcap, jstring jdiskpath, jlong jdisksize, jlong jdprate, jlong jmig_netspeed) {
+                              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);
 
@@ -85,8 +95,8 @@ Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring
   // disk_path = (*env)->GetStringUTFChars(env, jdiskpath, 0);
   // disk_path = xbt_strdup(disk_path);
 
-  msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (long) jramsize,
-                 (long) jnetcap, NULL, (long) jdisksize, (long) jdprate, (long) jmig_netspeed);
+  msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (int) jramsize,
+                 (int) jnetcap, NULL, (int) jdisksize, (int) jmig_netspeed, (int) jdp_intensity);
 
   jvm_bind(env,jvm,vm);
 }
@@ -113,10 +123,7 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_internalmig(JNIEnv *env, jobject jvm, jobject jhost) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   msg_host_t host = jhost_get_native(env, jhost);
-
-  XBT_INFO("Start migration of %s to %s", MSG_host_get_name(vm), MSG_host_get_name(host));
   MSG_vm_migrate(vm,host);
-  XBT_INFO("Migration done");
 }
 
 JNIEXPORT void JNICALL