Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'smpi-topo'
[simgrid.git] / src / bindings / java / org / simgrid / trace / Trace.java
1 /* JNI interface to C code for the TRACES part of SimGrid. */
2
3 /* Copyright (c) 2012-2014. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 package org.simgrid.trace;
10
11 import org.simgrid.msg.Msg;
12
13 public final class Trace {
14         /* Statically load the library which contains all native functions used in here */
15         static {
16                 Msg.nativeInit();
17         }
18
19         // TODO complete the binding of the tracing API 
20         
21
22         /**
23          * Declare a new user variable associated to hosts with a color. 
24          *  
25          * @param variable
26          * @param color
27          */
28         public final static native      void hostVariableDeclareWithColor (String variable, String color);
29         
30         
31         /**
32          *  Add a value to a variable of a host. 
33          *  
34          * @param host
35          * @param variable
36          * @param value
37          */
38         public final static native      void hostVariableAdd (String host, String variable, double value);
39
40         /**
41          * Subtract a value from a variable of a host. 
42          *  
43          * @param host
44          * @param variable
45          * @param value
46          */
47         public final static native      void hostVariableSub (String host, String variable, double value);
48
49         /**
50          * Set the value of a variable of a host at a given timestamp. 
51          * 
52          * @param time
53          * @param host
54          * @param variable
55          * @param value
56          */
57         public final static native      void hostVariableSetWithTime (double time, String host, String variable, double value);
58
59         /**
60          *      Add a value to a variable of a host at a given timestamp. 
61          * 
62          * @param time
63          * @param host
64          * @param variable
65          * @param value
66          */
67         public final static native      void hostVariableAddWithTime (double time, String host, String variable, double value);
68  
69         /**
70          * Subtract a value from a variable of a host at a given timestamp.  
71          * 
72          * @param time
73          * @param host
74          * @param variable
75          * @param value
76          */
77         public final static native      void hostVariableSubWithTime (double time, String host, String variable, double value);
78
79         /**
80          *  Get declared user host variables. 
81          * 
82          */
83         public final static native String[]  getHostVariablesName ();
84
85         /**
86          *  Declare a new user variable associated to links. 
87          *  
88          * @param variable
89          */
90         public final static native      void linkVariableDeclare (String variable);
91
92         /**
93          * Declare a new user variable associated to links with a color. 
94          * @param variable
95          * @param color
96          */
97         public final static native      void linkVariableDeclareWithColor (String variable, String color);
98
99         /**
100          *  Set the value of a variable of a link. 
101          *   
102          * @param link
103          * @param variable
104          * @param value
105          */
106         public final static native      void linkVariableSet (String link, String variable, double value);
107
108         /**
109          * Add a value to a variable of a link. 
110          * 
111          * @param link
112          * @param variable
113          * @param value
114          */
115         public final static native      void linkVariableAdd (String link, String variable, double value);
116  
117         /**
118          * Subtract a value from a variable of a link. 
119          * 
120          * @param link
121          * @param variable
122          * @param value
123          */
124         public final static native      void linkVariableSub (String link, String variable, double value);
125
126         /**
127          *  Set the value of a variable of a link at a given timestamp. 
128          *  
129          * @param time
130          * @param link
131          * @param variable
132          * @param value
133          */
134         public final static native      void linkVariableSetWithTime (double time, String link, String variable, double value);
135
136         /**
137          * Add a value to a variable of a link at a given timestamp.
138          * 
139          * @param time
140          * @param link
141          * @param variable
142          * @param value
143          */
144         public final static native      void linkVariableAddWithTime (double time, String link, String variable, double value);
145  
146
147         /**
148          * Subtract a value from a variable of a link at a given timestamp. 
149          *   
150          * @param time
151          * @param link
152          * @param variable
153          * @param value
154          */
155         public final static native      void linkVariableSubWithTime (double time, String link, String variable, double value);
156
157         /**
158          * Set the value of the variable present in the links connecting source and destination. 
159          * 
160          * @param src
161          * @param dst
162          * @param variable
163          * @param value
164          */
165         public final static native      void linkSrcDstVariableSet (String src, String dst, String variable, double value);
166  
167         /**
168          * Add a value to the variable present in the links connecting source and destination. 
169          *  
170          * @param src
171          * @param dst
172          * @param variable
173          * @param value
174          */
175         public final static native      void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
176
177         /**
178          * Subtract a value from the variable present in the links connecting source and destination. 
179          *   
180          * @param src
181          * @param dst
182          * @param variable
183          * @param value
184          */
185         public final static native      void linkSrcDstVariableSub (String src, String dst, String variable, double value);
186
187         /**
188          *  Set the value of the variable present in the links connecting source and destination at a given timestamp. 
189          *   
190          * @param time
191          * @param src
192          * @param dst
193          * @param variable
194          * @param value
195          */
196         public final static native      void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
197
198         /**
199          * Add a value to the variable present in the links connecting source and destination at a given timestamp. 
200          * 
201          * @param time
202          * @param src
203          * @param dst
204          * @param variable
205          * @param value
206          */
207         public final static native      void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
208  
209         /**
210          * Subtract a value from the variable present in the links connecting source and destination at a given timestamp. 
211          *  
212          * @param time
213          * @param src
214          * @param dst
215          * @param variable
216          * @param value
217          */
218         public final static native      void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
219
220         /**
221          *  Get declared user link variables.  
222          */
223         public final static native String[] getLinkVariablesName ();
224
225         
226                         /* **** ******** WARNINGS ************** ***** */       
227                         /* Only the following routines have been       */
228                         /* JNI implemented - Adrien May, 22nd          */
229                         /* **** ******************************** ***** */       
230                 
231     /**
232      * Declare a user state that will be associated to hosts. 
233      * A user host state can be used to trace application states.
234      * 
235      * @param name The name of the new state to be declared.
236      */
237         public final static native void hostStateDeclare(String name);
238         
239         /**
240          * Declare a new value for a user state associated to hosts.
241          * The color needs to be a string with three numbers separated by spaces in the range [0,1]. 
242          * A light-gray color can be specified using "0.7 0.7 0.7" as color. 
243          * 
244          * @param state The name of the new state to be declared.
245          * @param value The name of the value
246          * @param color The color of the value
247          */
248         public final static native void hostStateDeclareValue (String state, String value, String color);
249
250         /**
251          *      Set the user state to the given value.
252          *  (the queue is totally flushed and reinitialized with the given state).
253          *  
254          * @param host The name of the host to be considered.
255          * @param state The name of the state previously declared.
256          * @param value The new value of the state.
257          */
258         public final static native void hostSetState (String host, String state, String value);
259  
260         /**
261          * Push a new value for a state of a given host. 
262          * 
263          * @param host The name of the host to be considered.
264          * @param state The name of the state previously declared.
265          * @param value The value to be pushed.
266          */
267         public final static native void hostPushState (String host, String state, String value);
268         
269         /**
270          *  Pop the last value of a state of a given host. 
271          *   
272          * @param host The name of the host to be considered.
273          * @param state The name of the state to be popped.
274          */
275         public final static native void hostPopState (String host, String state);
276
277         /**
278          * Declare a new user variable associated to hosts. 
279          * 
280          * @param variable
281          */
282         public final static native      void hostVariableDeclare (String variable);
283  
284
285         /**
286          * Set the value of a variable of a host. 
287          * 
288          * @param host
289          * @param variable
290          * @param value
291          */
292         public final static native      void hostVariableSet (String host, String variable, double value);
293
294         /**
295          * Declare a new user variable associated to VMs. 
296          * 
297          * @param variable
298          */
299         public final static native      void vmVariableDeclare (String variable);
300  
301
302         /**
303          * Set the value of a variable of a VM. 
304          * 
305          * @param vm
306          * @param variable
307          * @param value
308          */
309         public final static native      void vmVariableSet (String vm, String variable, double value);
310 }