public class As {
- private long bind;
-
- protected As() {
+ private long bind;
+
+ protected As() {
};
- public String toString (){
- return this.getName();
- }
- public native String getName();
+ public String toString (){
+ return this.getName();
+ }
+ public native String getName();
- public native As[] getSons();
+ public native As[] getSons();
- public native String getProperty(String name);
+ public native String getProperty(String name);
- public native String getModel();
+ public native String getModel();
- public native Host[] getHosts();
+ public native Host[] getHosts();
- /**
- * Class initializer, to initialize various JNI stuff
- */
- public static native void nativeInit();
- static {
- nativeInit();
- }
+ /**
+ * Class initializer, to initialize various JNI stuff
+ */
+ public static native void nativeInit();
+ static {
+ nativeInit();
+ }
}
* @param timeout Time before giving up
*/
public native void waitCompletion(double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
-
+
/**
* Returns the task associated with the communication.
* if the communication isn't finished yet, will return null.
* Close the file.
*/
public native void close();
-
+
/**
* Class initializer, to initialize various JNI stuff
*/
* User data.
*/
private Object data;
- /**
- *
- */
- protected Host() {
+ /**
+ *
+ */
+ protected Host() {
this.bind = 0;
this.data = null;
};
-
+
public String toString (){
return this.name;
-
+
}
/**
* @param name The name of the host to get.
*
* @return The host object with the given name.
- * @exception HostNotFoundException if the name of the host is not valid.
+ * @exception HostNotFoundException if the name of the host is not valid.
* NativeException if the native version of this method failed.
*/
public native static Host getByName(String name)
- throws HostNotFoundException, NullPointerException;
+ throws HostNotFoundException, NullPointerException;
/**
* This static method returns the count of the installed hosts.
*
*/
public native static Host[] all();
- /**
- * This static method sets a mailbox to receive in asynchronous mode.
- *
- * All messages sent to this mailbox will be transferred to
- * the receiver without waiting for the receive call.
- * The receive call will still be necessary to use the received data.
- * If there is a need to receive some messages asynchronously, and some not,
- * two different mailboxes should be used.
- *
- * @param mailboxName The name of the mailbox
- */
- public static native void setAsyncMailbox(String mailboxName);
+ /**
+ * This static method sets a mailbox to receive in asynchronous mode.
+ *
+ * All messages sent to this mailbox will be transferred to
+ * the receiver without waiting for the receive call.
+ * The receive call will still be necessary to use the received data.
+ * If there is a need to receive some messages asynchronously, and some not,
+ * two different mailboxes should be used.
+ *
+ * @param mailboxName The name of the mailbox
+ */
+ public static native void setAsyncMailbox(String mailboxName);
/**
/**
* Sets the data of the host.
- * @param data
- */
+ * @param data
+ */
public void setData(Object data) {
this.data = data;
}
/**
* Gets the data of the host.
- *
- * @return The data object associated with the host.
- */
+ *
+ * @return The data object associated with the host.
+ */
public Object getData() {
return this.data;
}
/**
* Checks whether a host has data.
- *
- * @return True if the host has an associated data object.
- */
+ *
+ * @return True if the host has an associated data object.
+ */
public boolean hasData() {
return null != this.data;
}
* Returns the value of a given host property.
*/
public native String getProperty(String name);
-
+
/**
* Change the value of a given host property.
*/
public native void setProperty(String name, String value);
-
+
/** This method tests if a host is up and running.
* @return True if the host is available.
*/
public native boolean isOn();
/** This methods returns the list of mount point names on an host
- * @return An array containing all mounted storages on the host
- */
+ * @return An array containing all mounted storages on the host
+ */
public native Storage[] getMountedStorage();
/** This methods returns the list of storages attached to an host
- * @return An array containing all storages (name) attached to the host
- */
+ * @return An array containing all storages (name) attached to the host
+ */
public native String[] getAttachedStorage();
-
-
+
+
/**
* Class initializer, to initialize various JNI stuff
*/
package org.simgrid.msg;
import org.simgrid.NativeLib;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.File;
-
public final class Msg {
/* Statically load the library which contains all native functions used in here */
* -->
*/
public abstract class MsgException extends Exception {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- /**
- * Constructs an <code>MsgException</code> without a
- * detail message.
- */
- public MsgException() {
- super();
- }
- /**
- * Constructs an <code>MsgException</code> with a detail message.
- *
- * @param s the detail message.
- */
- public MsgException(String s) {
- super(s);
- }
+ /**
+ * Constructs an <code>MsgException</code> without a
+ * detail message.
+ */
+ public MsgException() {
+ super();
+ }
+ /**
+ * Constructs an <code>MsgException</code> with a detail message.
+ *
+ * @param s the detail message.
+ */
+ public MsgException(String s) {
+ super(s);
+ }
}
*/
public class Mutex {
private long bind; // The C object -- don't touch it
-
+
public Mutex() {
init();
}
private native void init();
public native void acquire();
public native void release();
-
+
/**
* Class initializer, to initialize various JNI stuff
*/
* under the terms of the license (GNU LGPL) which comes with this package. */
package org.simgrid.msg;
-
+
import java.util.Arrays;
import java.util.Vector;
* It is used to compute the id of an MSG process.
*/
public static long nextProcessId = 0;
-
+
/**
* Even if this attribute is public you must never access to it.
* It is compute automatically during the creation of the object.
* The native functions use this identifier to synchronize the process.
*/
public long id;
-
+
/**
* Start time of the process
*/
* Kill time of the process
*/
public double killTime = -1;
-
+
/**
* The name of the process.
*/
protected String name;
/**
- * The PID of the process
- */
+ * The PID of the process
+ */
protected int pid = -1;
/**
* The PPID of the process
/** The arguments of the method function of the process. */
public Vector<String> args;
-
+
/**
* Default constructor
*/
* @param args The arguments of the main function of the process.
*
* @exception HostNotFoundException if no host with this name exists.
- * NativeException
- * @throws NativeException
+ * NativeException
+ * @throws NativeException
*
*/
public Process(String hostname, String name, String args[]) throws HostNotFoundException, NativeException {
this.args = new Vector<String>();
if (null != args)
this.args.addAll(Arrays.asList(args));
-
+
this.startTime = startTime;
this.killTime = killTime;
}
* Returns the value of a given process property.
*/
public native String getProperty(String name);
-
+
/**
* Set the kill time of the process
* @param killTime the time when the process is killed
*/
public native void setKillTime(double killTime);
-
+
/**
* This static method returns the currently running process.
*
*/
public native void waitFor(double seconds) throws HostFailureException;
/**
- *
- */
- public void showArgs() {
+ *
+ */
+ public void showArgs() {
Msg.info("[" + this.name + "/" + this.getHost().getName() + "] argc=" +
this.args.size());
for (int i = 0; i < this.args.size(); i++)
Msg.info("[" + this.msgName() + "/" + this.getHost().getName() +
"] args[" + i + "]=" + this.args.get(i));
}
- /**
- * This method actually creates and run the process.
- * It is a noop if the process is already launched.
- * @throws HostNotFoundException
- */
- public final void start() throws HostNotFoundException {
- if (!started) {
- started = true;
- create(host.getName());
- }
- }
-
+ /**
+ * This method actually creates and run the process.
+ * It is a noop if the process is already launched.
+ * @throws HostNotFoundException
+ */
+ public final void start() throws HostNotFoundException {
+ if (!started) {
+ started = true;
+ create(host.getName());
+ }
+ }
+
/**
* This method runs the process. Il calls the method function that you must overwrite.
*/
Msg.info("Unexpected behavior. Stopping now");
System.exit(1);
}
- catch(ProcessKilledError pk) {
+ catch(ProcessKilledError pk) {
}
exit();
}
/**
* The main function of the process (to implement).
- *
- * @param args
- * @throws MsgException
- */
+ *
+ * @param args
+ * @throws MsgException
+ */
public abstract void main(String[]args) throws MsgException;
public native void exit();
* Release the C RngStream object
*/
private native void destroy();
-
+
/**
* Sets the initial seed of the package RngStreams to the six integers in the vector seed. This will
* be the seed (initial state) of the first stream. If this procedure is not called, the default initial
*/
public native void setAntithetic(boolean a);
/**
- * Sets the initial seed Ig of stream g to the vector seed. This vector must satisfy the same
- * conditions as in setPackageSeed. The stream is then reset to this initial seed. The
- * states and seeds of the other streams are not modified. As a result, after calling this procedure,
- * the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of
- * this procedure. Returns false for invalid seeds, and true otherwise.
+ * Sets the initial seed Ig of stream g to the vector seed. This vector must satisfy the same
+ * conditions as in setPackageSeed. The stream is then reset to this initial seed. The
+ * states and seeds of the other streams are not modified. As a result, after calling this procedure,
+ * the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of
+ * this procedure. Returns false for invalid seeds, and true otherwise.
*/
public native boolean setSeed(int seed[]);
/**
- * Advances the state of the stream by k values, without modifying the states of other streams (as
- * in RngStream_SetSeed), nor the values of Bg and Ig associated with this stream. If e > 0, then
- * k = 2e + c; if e < 0, then k = -2-e + c; and if e = 0, then k = c. Note: c is allowed to take
- * negative values. We discourage the use of this procedure.
- */
+ * Advances the state of the stream by k values, without modifying the states of other streams (as
+ * in RngStream_SetSeed), nor the values of Bg and Ig associated with this stream. If e > 0, then
+ * k = 2e + c; if e < 0, then k = -2-e + c; and if e = 0, then k = c. Note: c is allowed to take
+ * negative values. We discourage the use of this procedure.
+ */
public native void advanceState(int e, int g);
-
+
/**
* Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), after advancing the state by one step. The returned number has 32 bits of precision
* in the sense that it is always a multiple of 1/(232 - 208), unless RngStream_IncreasedPrecis
* {i, i + 1, . . . , j}
*/
public native int randInt(int i, int j);
-
+
/**
* Class initializer, to initialize various JNI stuff
*/
*/
public class Semaphore {
- private long bind; // The C object -- don't touch it
- /**
- * Semaphore capacity, defined when the semaphore is created. At most capacity
- * process can acquire this semaphore at the same time.
- */
- protected final int capacity;
- /**
- * Creates a new semaphore with the given capacity. At most capacity
- * process can acquire this semaphore at the same time.
- */
- public Semaphore(int capacity) {
- init(capacity);
- this.capacity = capacity;
- }
- /** The native implementation of semaphore initialization
- */
- private native void init(int capacity);
+ private long bind; // The C object -- don't touch it
+ /**
+ * Semaphore capacity, defined when the semaphore is created. At most capacity
+ * process can acquire this semaphore at the same time.
+ */
+ protected final int capacity;
+ /**
+ * Creates a new semaphore with the given capacity. At most capacity
+ * process can acquire this semaphore at the same time.
+ */
+ public Semaphore(int capacity) {
+ init(capacity);
+ this.capacity = capacity;
+ }
+ /** The native implementation of semaphore initialization
+ */
+ private native void init(int capacity);
- /** Locks on the semaphore object until the provided timeout expires
- * @exception TimeoutException if the timeout expired before
- * the semaphore could be acquired.
- */
- public native void acquire(double timeout) throws TimeoutException;
- /** Locks on the semaphore object with no timeout
- */
- public void acquire() {
- try {
- acquire(-1);
- } catch (TimeoutException e) {
- // This should not happen.
- assert(false);
+ /** Locks on the semaphore object until the provided timeout expires
+ * @exception TimeoutException if the timeout expired before
+ * the semaphore could be acquired.
+ */
+ public native void acquire(double timeout) throws TimeoutException;
+ /** Locks on the semaphore object with no timeout
+ */
+ public void acquire() {
+ try {
+ acquire(-1);
+ } catch (TimeoutException e) {
+ // This should not happen.
+ assert(false);
+ }
}
- }
- /** Releases the semaphore object
- */
- public native void release();
- /** returns a boolean indicating it this semaphore would block at this very specific time
- *
- * Note that the returned value may be wrong right after the
- * function call, when you try to use it... But that's a
- * classical semaphore issue, and SimGrid's semaphores are not
- * different to usual ones here.
- */
- public native boolean wouldBlock();
+ /** Releases the semaphore object
+ */
+ public native void release();
+ /** returns a boolean indicating it this semaphore would block at this very specific time
+ *
+ * Note that the returned value may be wrong right after the
+ * function call, when you try to use it... But that's a
+ * classical semaphore issue, and SimGrid's semaphores are not
+ * different to usual ones here.
+ */
+ public native boolean wouldBlock();
- /** Returns the semaphore capacity
- */
- public int getCapacity(){
- return this.capacity;
- }
+ /** Returns the semaphore capacity
+ */
+ public int getCapacity(){
+ return this.capacity;
+ }
- /** Deletes this semaphore
- */
- protected void finalize() {
- destroy();
- }
- /** The native implementation for destroying a semaphore
- */
- private native void destroy();
- /**
- * Class initializer, to initialize various JNI stuff
- */
- public static native void nativeInit();
- static {
- Msg.nativeInit();
- nativeInit();
- }
+ /** Deletes this semaphore
+ */
+ protected void finalize() {
+ destroy();
+ }
+ /** The native implementation for destroying a semaphore
+ */
+ private native void destroy();
+ /**
+ * Class initializer, to initialize various JNI stuff
+ */
+ public static native void nativeInit();
+ static {
+ Msg.nativeInit();
+ nativeInit();
+ }
}
\ No newline at end of file
* access to it.
*/
private long bind;
-
+
/**
* Storage name
*/
* User data.
*/
private Object data;
- /**
- *
- */
- protected Storage() {
+ /**
+ *
+ */
+ protected Storage() {
this.bind = 0;
this.data = null;
};
-
+
public String toString (){
return this.name;
-
+
}
-
+
/**
* This static method gets a storage instance associated with a native
* storage of your platform. This is the best way to get a java storage object.
* @param name The name of the storage to get.
*
* @return The storage object with the given name.
- * @exception StorageNotFoundException if the name of the storage is not valid.
+ * @exception StorageNotFoundException if the name of the storage is not valid.
* NativeException if the native version of this method failed.
*/
public native static Storage getByName(String name)
- throws HostNotFoundException, NullPointerException;
+ throws HostNotFoundException, NullPointerException;
/**
* This method returns the name of a storage.
public String getName() {
return name;
}
-
+
/**
* This method returns the size (in bytes) of a storage element.
*
*
*/
public native long getFreeSize();
-
+
/**
* This method returns the used size (in bytes) of a storage element.
*
*
*/
public native long getUsedSize();
-
+
/**
* Returns the value of a given storage property.
*/
public native String getProperty(String name);
-
+
/**
* Change the value of a given storage property.
*/
public native void setProperty(String name, String value);
-
-
+
+
/**
*
* Returns the host name the storage is attached to
* @return the host name the storage is attached to
*/
public native String getHost();
-
+
/**
* This static method returns all of the storages of the installed platform.
*
*
*/
public native static Storage[] all();
-
+
/**
* Class initializer, to initialize various JNI stuff
*/
static {
nativeInit();
}
-
+
}
\ No newline at end of file
public Task(String name, Host[]hosts, double[]flopsAmount, double[]bytesAmount) {
parallelCreate(name, hosts, flopsAmount, bytesAmount);
}
-
+
/**
* The natively implemented method to create a MSG task.
*
private final native void create(String name,
double flopsAmount,
double bytesAmount)
- throws IllegalArgumentException;
+ throws IllegalArgumentException;
/**
* The natively implemented method to create a MSG parallel task.
*
Host[]hosts,
double[]flopsAmount,
double[]bytesAmount)
- throws NullPointerException, IllegalArgumentException;
+ throws NullPointerException, IllegalArgumentException;
/* * * *
* * Getters / Setters * *
* * * */
- /** Gets the name of a task */
+ /** Gets the name of a task */
public String getName() {
return name;
}
-
+
/** Gets the sender of the task (or null if not sent yet) */
public native Process getSender();
-
+
/** Gets the source of the task (or null if not sent yet). */
public native Host getSource();
-
+
/** Gets the remaining amount of flops to execute in this task
*
* If it's ongoing, you get the exact amount at the present time. If it's already done, it's 0.
* @param priority The new priority of the task.
*/
public native void setPriority(double priority);
-
+
/** Set the computation amount needed to process the task
*
* Warning if the execution is already started and ongoing, this call does nothing.
* * * */
/**
* Executes a task on the location on which the current process is running.
- *
- * @throws HostFailureException
- * @throws TaskCancelledException
- */
+ *
+ * @throws HostFailureException
+ * @throws TaskCancelledException
+ */
public native void execute() throws HostFailureException,TaskCancelledException;
-
+
/** Bound a computation to a certain load */
public native void setBound(double load);
* * Communication-related * *
* * * */
- /** Send the task asynchronously on the mailbox identified by the specified name,
+ /** Send the task asynchronously on the specified mailbox,
* with no way to retrieve whether the communication succeeded or not
*
*/
public native void dsendBounded(String mailbox, double maxrate);
- /** Send the task asynchronously on the mailbox identified by the specified name,
+ /** Send the task asynchronously on the specified mailbox,
* with no way to retrieve whether the communication succeeded or not
*
*/
public native void dsend(String mailbox);
-
+
/**
- * Sends the task on the mailbox identified by the specified name
+ * Sends the task on the specified mailbox
*
- * @param mailbox
- * @throws TimeoutException
+ * @param mailbox where to send the message
+ * @throws TimeoutException
* @throws HostFailureException
* @throws TransferFailureException
*/
}
/**
- * Sends the task on the mailbox identified by the specified name (wait at most \a timeout seconds)
+ * Sends the task on the specified mailbox (wait at most \a timeout seconds)
*
- * @param mailbox
- * @param timeout
- * @exception NativeException if the retrieval fails.
+ * @param mailbox where to send the message
+ * @param timeout
+ * @exception NativeException if the retrieval fails.
* @throws TimeoutException
* @throws HostFailureException
* @throws TransferFailureException
*/
public native void send(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
- /**
- * Sends the task on the mailbox identified by the specified alias (capping the sending rate to \a maxrate)
+
+ /** Sends the task on the specified mailbox (capping the sending rate to \a maxrate)
*
- * @param alias
- * @param maxrate
- * @throws TransferFailureException
- * @throws HostFailureException
- * @throws TimeoutException
+ * @param mailbox where to send the message
+ * @param maxrate
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
*/
- public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
- sendBounded(alias,-1,maxrate);
- }
+ public void sendBounded(String mailbox, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
+ sendBounded(mailbox,-1,maxrate);
+ }
-/**
- * Sends the task on the mailbox identified by the specified alias (capping the sending rate to \a maxrate) with a timeout
+ /** Sends the task on the specified mailbox (capping the sending rate to \a maxrate) with a timeout
*
- * @param alias
- * @param timeout
- * @param maxrate
- * @throws TransferFailureException
- * @throws HostFailureException
- * @throws TimeoutException
+ * @param mailbox where to send the message
+ * @param timeout
+ * @param maxrate
+ * @throws TransferFailureException
+ * @throws HostFailureException
+ * @throws TimeoutException
*/
- public native void sendBounded(String alias, double timeout, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException;
+ public native void sendBounded(String mailbox, double timeout, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException;
/**
* Sends the task on the mailbox asynchronously (capping the sending rate to \a maxrate)
*/
public native Comm isendBounded(String mailbox, double maxrate);
-
+
/**
* Starts listening for receiving a task from an asynchronous communication
/**
* Retrieves next task from the mailbox identified by the specified name
*
- * @param mailbox
+ * @param mailbox
*/
public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
/**
* Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds)
*
- * @param mailbox
- * @param timeout
+ * @param mailbox
+ * @param timeout
*/
public static Task receive(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException {
return receive(mailbox, timeout, null);
/**
* Retrieves next task sent by a given host on the mailbox identified by the specified alias
*
- * @param mailbox
- * @param host
+ * @param mailbox
+ * @param host
*/
public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
/**
* Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
*
- * @param mailbox
- * @param timeout
- * @param host
+ * @param mailbox
+ * @param timeout
+ * @param host
*/
public native static Task receive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException;
/**
* Retrieves next task from the mailbox identified by the specified name with a capped rate
*
- * @param mailbox
+ * @param mailbox
*/
public static Task receiveBounded(String mailbox, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
/**
* Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds) with a capped rate
*
- * @param mailbox
- * @param timeout
+ * @param mailbox
+ * @param timeout
*/
public static Task receiveBounded(String mailbox, double timeout, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
return receiveBounded(mailbox, timeout, null, rate);
/**
* Retrieves next task sent by a given host on the mailbox identified by the specified alias with a capped rate
*
- * @param mailbox
- * @param host
+ * @param mailbox
+ * @param host
*/
public static Task receiveBounded(String mailbox, Host host, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
* Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
* with a capped rate
*
- * @param mailbox
- * @param timeout
- * @param host
+ * @param mailbox
+ * @param timeout
+ * @param host
*/
public native static Task receiveBounded(String mailbox, double timeout, Host host, double rate) throws TransferFailureException, HostFailureException, TimeoutException;
-
-
+
+
/**
* Tests whether there is a pending communication on the mailbox identified by the specified alias, and who sent it
- */
+ */
public native static int listenFrom(String mailbox);
/**
* Listen whether there is a waiting task on the mailbox identified by the specified alias
- */
+ */
public native static boolean listen(String mailbox);
/**
* Counts the number of tasks waiting to be received on the \a mailbox identified by the specified alia and sended by the specified \a host.
- */
+ */
public native static int listenFromHost(String alias, Host host);
-
+
/**
* Class initializer, to initialize various JNI stuff
*/
package org.simgrid.msg;
-import org.simgrid.msg.Host;
-import org.simgrid.msg.Process;
public class VM extends Host{
// Please note that we are not declaring a new bind variable
//(the bind variable has been inherited from the super class Host)
-
+
/* Static functions */
// GetByName is inherited from the super class Host
-
- private static VM[] vms=null;
- private Host currentHost;
+
+ private static VM[] vms=null;
+ private Host currentHost;
/* Constructors / destructors */
- /**
+ /**
* Create a `basic' VM (i.e. 1 core, 1GB of RAM, other values are not taken into account).
*/
public VM(Host host, String name) {
private static void addVM(VM vm){
VM[] vmsN=null;
- int i=0;
+ int i=0;
if(VM.vms == null)
vmsN = new VM[1];
else
vmsN = new VM[vms.length+1];
-
+
for (i=0; i<vmsN.length-1 ; i ++){
vmsN[i]=vms[i];
}
vmsN[i]=vm;
vms=vmsN;
}
- public static VM[] all(){
+ public static VM[] all(){
return vms;
}
public static VM getVMByName(String name){
for (int i=0 ; i < vms.length ; i++){
- if (vms[i].getName().equals(name))
- return vms[i];
+ if (vms[i].getName().equals(name))
+ return vms[i];
}
return null;
}
protected void finalize() {
destroy();
}
-
+
/* JNI / Native code */
/* get/set property methods are inherited from the Host class. */
-
+
/** Returns whether the given VM is currently suspended
*/
public native int isCreated();
-
+
/** Returns whether the given VM is currently running
*/
public native int isRunning();
/** Returns whether the given VM is currently running
*/
public native int isMigrating();
-
+
/** Returns whether the given VM is currently suspended
*/
public native int isSuspended();
-
+
/** Returns whether the given VM is currently saving
*/
public native int isSaving();
-
+
/** Returns whether the given VM is currently saved
*/
public native int isSaved();
/** Returns whether the given VM is currently restoring its state
*/
public native boolean isRestoring();
-
+
/**
* Natively implemented method create the VM.
* @param nCore number of core
* @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 nCore, int ramSize,
- int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity);
+ int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity);
/**
*/
public native void start();
-
+
/**
* Immediately kills all processes within the given VM. Any memory that they allocated will be leaked.
* No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep() or something
*/
public native void shutdown();
-
+
/**
* Invoke native migration routine
- */
+ */
public native void internalmig(Host destination) throws Exception; // TODO add throws DoubleMigrationException (i.e. when you call migrate on a VM that is already migrating);
-
+
/** Change the host on which all processes are running
* (pre-copy is implemented)
*/
try {
this.internalmig(destination);
} catch (Exception e){
- Msg.info("an exception occurs during the migration of VM "+this.getName());
- throw new HostFailureException();
+ Msg.info("an exception occurs during the migration of VM "+this.getName());
+ throw new HostFailureException();
}
// If the migration correcly returned, then we should change the currentHost value.
this.currentHost = destination;
}
-
+
/** Immediately suspend the execution of all processes within the given VM
*
* No suspension cost occurs. If you want to simulate this too, you want to
* of VM suspend to you.
*/
public native void suspend();
-
+
/** Immediately resumes the execution of all processes within the given VM
*
* No resume cost occurs. If you want to simulate this too, you want to
* of VM resume to you.
*/
public native void resume();
-
+
/** Immediately suspend the execution of all processes within the given VM
* and save its state on the persistent HDD
* Not yet implemented (for the moment it behaves like suspend)
* of VM suspend to you.
*/
public native void save();
-
+
/** Immediately resumes the execution of all processes previously saved
* within the given VM
* Not yet implemented (for the moment it behaves like resume)
* of VM resume to you.
*/
public native void restore();
-
+
/**
* Destroy the VM
*/
public native void destroy();
-
+
/**
* Class initializer, to initialize various JNI stuff
}
// TODO complete the binding of the tracing API
-
+
/**
* Declare a new user variable associated to hosts with a color.
* @param color
*/
public final static native void hostVariableDeclareWithColor (String variable, String color);
-
-
+
+
/**
* Add a value to a variable of a host.
*
public final static native void hostVariableSub (String host, String variable, double value);
/**
- * Set the value of a variable of a host at a given timestamp.
- *
+ * Set the value of a variable of a host at a given timestamp.
+ *
* @param time
* @param host
* @param variable
* @param variable
* @param value
*/
- public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
-
- /**
- * Subtract a value from a variable of a host at a given timestamp.
- *
- * @param time
- * @param host
- * @param variable
- * @param value
- */
- public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
-
- /**
- * Get declared user host variables.
- *
- */
- public final static native String[] getHostVariablesName ();
-
- /**
- * Declare a new user variable associated to links.
- *
- * @param variable
- */
- public final static native void linkVariableDeclare (String variable);
-
- /**
- * Declare a new user variable associated to links with a color.
- * @param variable
- * @param color
- */
- public final static native void linkVariableDeclareWithColor (String variable, String color);
-
- /**
- * Set the value of a variable of a link.
- *
- * @param link
- * @param variable
- * @param value
- */
- public final static native void linkVariableSet (String link, String variable, double value);
-
- /**
- * Add a value to a variable of a link.
- *
- * @param link
- * @param variable
- * @param value
- */
- public final static native void linkVariableAdd (String link, String variable, double value);
-
- /**
- * Subtract a value from a variable of a link.
- *
- * @param link
- * @param variable
- * @param value
- */
- public final static native void linkVariableSub (String link, String variable, double value);
-
- /**
- * Set the value of a variable of a link at a given timestamp.
- *
- * @param time
- * @param link
- * @param variable
- * @param value
- */
- public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
-
- /**
- * Add a value to a variable of a link at a given timestamp.
- *
+ public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
+
+ /**
+ * Subtract a value from a variable of a host at a given timestamp.
+ *
* @param time
- * @param link
- * @param variable
- * @param value
- */
- public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
-
-
- /**
- * Subtract a value from a variable of a link at a given timestamp.
- *
- * @param time
- * @param link
- * @param variable
- * @param value
- */
- public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
-
- /**
- * Set the value of the variable present in the links connecting source and destination.
- *
- * @param src
- * @param dst
- * @param variable
- * @param value
- */
- public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
-
- /**
- * Add a value to the variable present in the links connecting source and destination.
- *
- * @param src
- * @param dst
- * @param variable
- * @param value
- */
- public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
-
- /**
- * Subtract a value from the variable present in the links connecting source and destination.
- *
- * @param src
- * @param dst
- * @param variable
- * @param value
- */
- public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
-
- /**
- * Set the value of the variable present in the links connecting source and destination at a given timestamp.
- *
- * @param time
- * @param src
- * @param dst
- * @param variable
- * @param value
- */
- public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
-
- /**
- * Add a value to the variable present in the links connecting source and destination at a given timestamp.
- *
- * @param time
- * @param src
- * @param dst
- * @param variable
- * @param value
- */
- public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
-
- /**
- * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
- *
- * @param time
- * @param src
- * @param dst
- * @param variable
- * @param value
- */
- public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
-
- /**
- * Get declared user link variables.
- */
+ * @param host
+ * @param variable
+ * @param value
+ */
+ public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
+
+ /**
+ * Get declared user host variables.
+ *
+ */
+ public final static native String[] getHostVariablesName ();
+
+ /**
+ * Declare a new user variable associated to links.
+ *
+ * @param variable
+ */
+ public final static native void linkVariableDeclare (String variable);
+
+ /**
+ * Declare a new user variable associated to links with a color.
+ * @param variable
+ * @param color
+ */
+ public final static native void linkVariableDeclareWithColor (String variable, String color);
+
+ /**
+ * Set the value of a variable of a link.
+ *
+ * @param link
+ * @param variable
+ * @param value
+ */
+ public final static native void linkVariableSet (String link, String variable, double value);
+
+ /**
+ * Add a value to a variable of a link.
+ *
+ * @param link
+ * @param variable
+ * @param value
+ */
+ public final static native void linkVariableAdd (String link, String variable, double value);
+
+ /**
+ * Subtract a value from a variable of a link.
+ *
+ * @param link
+ * @param variable
+ * @param value
+ */
+ public final static native void linkVariableSub (String link, String variable, double value);
+
+ /**
+ * Set the value of a variable of a link at a given timestamp.
+ *
+ * @param time
+ * @param link
+ * @param variable
+ * @param value
+ */
+ public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
+
+ /**
+ * Add a value to a variable of a link at a given timestamp.
+ *
+ * @param time
+ * @param link
+ * @param variable
+ * @param value
+ */
+ public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
+
+
+ /**
+ * Subtract a value from a variable of a link at a given timestamp.
+ *
+ * @param time
+ * @param link
+ * @param variable
+ * @param value
+ */
+ public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
+
+ /**
+ * Set the value of the variable present in the links connecting source and destination.
+ *
+ * @param src
+ * @param dst
+ * @param variable
+ * @param value
+ */
+ public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
+
+ /**
+ * Add a value to the variable present in the links connecting source and destination.
+ *
+ * @param src
+ * @param dst
+ * @param variable
+ * @param value
+ */
+ public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
+
+ /**
+ * Subtract a value from the variable present in the links connecting source and destination.
+ *
+ * @param src
+ * @param dst
+ * @param variable
+ * @param value
+ */
+ public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
+
+ /**
+ * Set the value of the variable present in the links connecting source and destination at a given timestamp.
+ *
+ * @param time
+ * @param src
+ * @param dst
+ * @param variable
+ * @param value
+ */
+ public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
+
+ /**
+ * Add a value to the variable present in the links connecting source and destination at a given timestamp.
+ *
+ * @param time
+ * @param src
+ * @param dst
+ * @param variable
+ * @param value
+ */
+ public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
+
+ /**
+ * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
+ *
+ * @param time
+ * @param src
+ * @param dst
+ * @param variable
+ * @param value
+ */
+ public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
+
+ /**
+ * Get declared user link variables.
+ */
public final static native String[] getLinkVariablesName ();
-
- /* **** ******** WARNINGS ************** ***** */
- /* Only the following routines have been */
- /* JNI implemented - Adrien May, 22nd */
- /* **** ******************************** ***** */
-
- /**
- * Declare a user state that will be associated to hosts.
- * A user host state can be used to trace application states.
- *
- * @param name The name of the new state to be declared.
- */
+
+ /* **** ******** WARNINGS ************** ***** */
+ /* Only the following routines have been */
+ /* JNI implemented - Adrien May, 22nd */
+ /* **** ******************************** ***** */
+
+ /**
+ * Declare a user state that will be associated to hosts.
+ * A user host state can be used to trace application states.
+ *
+ * @param name The name of the new state to be declared.
+ */
public final static native void hostStateDeclare(String name);
-
+
/**
* Declare a new value for a user state associated to hosts.
* The color needs to be a string with three numbers separated by spaces in the range [0,1].
* @param state The name of the state previously declared.
* @param value The new value of the state.
*/
- public final static native void hostSetState (String host, String state, String value);
-
- /**
- * Push a new value for a state of a given host.
- *
- * @param host The name of the host to be considered.
- * @param state The name of the state previously declared.
- * @param value The value to be pushed.
- */
- public final static native void hostPushState (String host, String state, String value);
-
- /**
- * Pop the last value of a state of a given host.
- *
- * @param host The name of the host to be considered.
- * @param state The name of the state to be popped.
- */
- public final static native void hostPopState (String host, String state);
+ public final static native void hostSetState (String host, String state, String value);
+
+ /**
+ * Push a new value for a state of a given host.
+ *
+ * @param host The name of the host to be considered.
+ * @param state The name of the state previously declared.
+ * @param value The value to be pushed.
+ */
+ public final static native void hostPushState (String host, String state, String value);
+
+ /**
+ * Pop the last value of a state of a given host.
+ *
+ * @param host The name of the host to be considered.
+ * @param state The name of the state to be popped.
+ */
+ public final static native void hostPopState (String host, String state);
/**
* Declare a new user variable associated to hosts.
* @param variable
*/
public final static native void hostVariableDeclare (String variable);
-
+
/**
* Set the value of a variable of a host.
* @param variable
*/
public final static native void vmVariableDeclare (String variable);
-
+
/**
* Set the value of a variable of a VM.