Logo AND Algorithmique Numérique Distribuée

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