Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix compilation without tracing
[simgrid.git] / org / simgrid / msg / VM.java
1 /*
2  * JNI interface to Cloud interface in Simgrid
3  * 
4  * Copyright 2006,2007,2010,2012 The SimGrid Team.           
5  * All right reserved. 
6  *
7  * This program is free software; you can redistribute 
8  * it and/or modify it under the terms of the license 
9  * (GNU LGPL) which comes with this package.
10  */
11 package org.simgrid.msg;
12
13 import org.simgrid.msg.Process;
14
15 public class VM {
16         /**
17          * This attribute represents a bind between a java task object and
18          * a native task. Even if this attribute is public you must never
19          * access to it. It is set automatically during the build of the object.
20          */
21         private long bind = 0;
22         
23         private int coreAmount;
24         /**
25          * @brief Create a new empty VM.
26          * @bug it is expected that in the future, the coreAmount parameter will be used
27          * to add extra constraints on the execution, but the argument is ignored for now.
28          */
29         public VM(int coreAmount) {
30                 this.coreAmount = coreAmount;
31         }
32         /**
33          * Natively implemented method starting the VM.
34          * @param coreAmount
35          */
36         private native void start(int coreAmount);
37         
38         /**
39          * @brief Returns a new array containing all existing VMs.
40          */
41         public static native VM[] all();
42         
43         /** @brief Returns whether the given VM is currently suspended
44          */     
45         public native boolean isSuspended();
46         /** @brief Returns whether the given VM is currently running
47          */
48         public native boolean isRunning();
49         /** @brief Add the given process into the VM.
50          * Afterward, when the VM is migrated or suspended or whatever, the process will have the corresponding handling, too.
51          */     
52         public native void bind(Process process);
53         /** @brief Removes the given process from the given VM, and kill it
54          *  Will raise a ProcessNotFound exception if the process were not binded to that VM
55          */     
56         public native void unbind(Process process);
57         /** @brief Immediately change the host on which all processes are running
58          *
59          * No migration cost occurs. If you want to simulate this too, you want to use a
60          * Task.send() before or after, depending on whether you want to do cold or hot
61          * migration.
62          */     
63         public native void migrate(Host destination);
64         /** @brief Immediately suspend the execution of all processes within the given VM
65          *
66          * No suspension cost occurs. If you want to simulate this too, you want to
67          * use a \ref File.write() before or after, depending on the exact semantic
68          * of VM suspend to you.
69          */     
70         public native void suspend();
71         /** @brief Immediately resumes the execution of all processes within the given VM
72          *
73          * No resume cost occurs. If you want to simulate this too, you want to
74          * use a \ref File.read() before or after, depending on the exact semantic
75          * of VM resume to you.
76          */
77         public native void resume();
78                 
79 }