Logo AND Algorithmique Numérique Distribuée

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