Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No vm when ptask on
[simgrid.git] / src / bindings / java / jmsg_vm.c
index 8948b57..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,19 @@ 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, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize) {
+                              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);
 
   const char *name;
@@ -85,7 +96,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) jnetcap, NULL, (int) jdisksize, (int) jmig_netspeed, (int) jdp_intensity);
 
   jvm_bind(env,jvm,vm);
 }
@@ -112,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
@@ -135,7 +143,7 @@ Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm) {
   MSG_vm_save(vm);
 }
 JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_retore(JNIEnv *env, jobject jvm) {
+Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   MSG_vm_restore(vm);
 }