Logo AND Algorithmique Numérique Distribuée

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