X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/19b3962253112b19308537bc2400de141c119d99..7bc340a73928fe73a57a9664aeba0cf5a92b654c:/src/bindings/java/org/simgrid/msg/VM.java diff --git a/src/bindings/java/org/simgrid/msg/VM.java b/src/bindings/java/org/simgrid/msg/VM.java index 8338a79c50..cdd7cd797d 100644 --- a/src/bindings/java/org/simgrid/msg/VM.java +++ b/src/bindings/java/org/simgrid/msg/VM.java @@ -11,25 +11,54 @@ public class VM extends Host { // No need to declare a new bind variable: we use the one inherited from the super class Host private Host currentHost; + private int coreAmount = 1; - /** Create a `basic' VM (i.e. 1GB of RAM, other values are not taken into account). */ + /** + * Create a `basic' VM : 1 core and 1GB of RAM. + * @param host Host node + * @param name name of the machine + */ public VM(Host host, String name) { - this(host,name,1024, 0, 0); + this(host,name, /*coreAmount*/1, 1024, 0, 0); + } + + /** + * Create a VM without useless values (for humans) + * @param host Host node + * @param name name of the machine + * @param coreAmount the amount of cores of the VM + */ + public VM(Host host, String name, int coreAmount) { + this(host,name, coreAmount, 1024, 0, 0); + } + + /** + * Create a VM with 1 core + * @param host Host node + * @param name name of the machine + * @param ramSize size of the RAM that should be allocated (in MBytes) + * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;)) + * @param dpIntensity (dirty page percentage according to migNetSpeed, [0-100], if you don't know put zero ;)) + */ + public VM(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity){ + this(host, name, /*coreAmount*/1, ramSize, migNetSpeed, dpIntensity); } /** * Create a VM * @param host Host node * @param name name of the machine + * @param coreAmount the amount of cores of the VM * @param ramSize size of the RAM that should be allocated (in MBytes) * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;)) * @param dpIntensity (dirty page percentage according to migNetSpeed, [0-100], if you don't know put zero ;)) */ - public VM(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity){ + public VM(Host host, String name, int coreAmount, int ramSize, int migNetSpeed, int dpIntensity){ super(); super.name = name; this.currentHost = host; - create(host, name, ramSize, migNetSpeed, dpIntensity); + this.coreAmount = coreAmount; + create(host, name, coreAmount, ramSize, migNetSpeed, dpIntensity); } /** Retrieve the list of all existing VMs */ @@ -68,13 +97,18 @@ public class VM extends Host { /** Returns whether the given VM is currently suspended */ public native int isSuspended(); + /** Returns the amount of virtual CPUs provided */ + public int getCoreAmount() { + return coreAmount; + } + /** * Natively implemented method create the VM. * @param ramSize size of the RAM that should be allocated (in MB) * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;)) * @param dpIntensity (dirty page intensity, a percentage of migNetSpeed [0-100], if you don't know put zero ;)) */ - private native void create(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity); + private native void create(Host host, String name, int coreAmount, int ramSize, int migNetSpeed, int dpIntensity); /**