Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[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-2022. 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   private Trace() {
20     throw new IllegalStateException("Utility class \"Trace\"");
21   }
22
23   // TODO complete the binding of the tracing API
24
25   /**
26    * Declare a new user variable associated to hosts with a color.
27    *
28    * @param variable
29    * @param color
30    */
31   public static final native void hostVariableDeclareWithColor (String variable, String color);
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 static final 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 static final 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 static final 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 static final 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 static final native void hostVariableSubWithTime (double time, String host, String variable, double value);
80
81   /**
82    *  Get declared user host variables.
83    *
84    */
85   public static final native String[]  getHostVariablesName ();
86
87   /**
88    *  Declare a new user variable associated to links.
89    *
90    * @param variable
91    */
92   public static final 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 static final 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 static final 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 static final 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 static final 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 static final 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 static final native void linkVariableAddWithTime (double time, String link, String variable, double value);
147
148   /**
149    * Subtract a value from a variable of a link at a given timestamp.
150    *
151    * @param time
152    * @param link
153    * @param variable
154    * @param value
155    */
156   public static final native void linkVariableSubWithTime (double time, String link, String variable, double value);
157
158   /**
159    * Set the value of the variable present in the links connecting source and destination.
160    *
161    * @param src
162    * @param dst
163    * @param variable
164    * @param value
165    */
166   public static final native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
167
168   /**
169    * Add a value to the variable present in the links connecting source and destination.
170    *
171    * @param src
172    * @param dst
173    * @param variable
174    * @param value
175    */
176   public static final native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
177
178   /**
179    * Subtract a value from the variable present in the links connecting source and destination.
180    *
181    * @param src
182    * @param dst
183    * @param variable
184    * @param value
185    */
186   public static final native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
187
188   /**
189    *  Set the value of the variable present in the links connecting source and destination at a given timestamp.
190    *
191    * @param time
192    * @param src
193    * @param dst
194    * @param variable
195    * @param value
196    */
197   public static final native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
198
199   /**
200    * Add a value to the variable present in the links connecting source and destination at a given timestamp.
201    *
202    * @param time
203    * @param src
204    * @param dst
205    * @param variable
206    * @param value
207    */
208   public static final native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
209
210   /**
211    * Subtract a value from 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 static final native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
220
221   /**
222    *  Get declared user link variables.
223    */
224   public static final native String[] getLinkVariablesName ();
225
226
227   /* **** ******** WARNINGS ************** ***** */
228   /* Only the following routines have been       */
229   /* JNI implemented - Adrien May, 22nd          */
230   /* **** ******************************** ***** */
231
232   /**
233    * Declare a user state that will be associated to hosts.
234    * A user host state can be used to trace application states.
235    *
236    * @param name The name of the new state to be declared.
237    */
238   public static final native void hostStateDeclare(String name);
239
240   /**
241    * Declare a new value for a user state associated to hosts.
242    * The color needs to be a string with three numbers separated by spaces in the range [0,1].
243    * A light-gray color can be specified using "0.7 0.7 0.7" as color.
244    *
245    * @param state The name of the new state to be declared.
246    * @param value The name of the value
247    * @param color The color of the value
248    */
249   public static final native void hostStateDeclareValue (String state, String value, String color);
250
251   /**
252    *   Set the user state to the given value.
253    *  (the queue is totally flushed and reinitialized with the given state).
254    *
255    * @param host The name of the host to be considered.
256    * @param state The name of the state previously declared.
257    * @param value The new value of the state.
258    */
259   public static final native void hostSetState (String host, String state, String value);
260
261   /**
262    * Push a new value for a state of a given host.
263    *
264    * @param host The name of the host to be considered.
265    * @param state The name of the state previously declared.
266    * @param value The value to be pushed.
267    */
268   public static final native void hostPushState (String host, String state, String value);
269
270   /**
271    *  Pop the last value of a state of a given host.
272    *
273    * @param host The name of the host to be considered.
274    * @param state The name of the state to be popped.
275    */
276   public static final native void hostPopState (String host, String state);
277
278   /**
279    * Declare a new user variable associated to hosts.
280    *
281    * @param variable
282    */
283   public static final native void hostVariableDeclare (String variable);
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 static final 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 static final native void vmVariableDeclare (String variable);
300
301   /**
302    * Set the value of a variable of a VM.
303    *
304    * @param vm
305    * @param variable
306    * @param value
307    */
308   public static final native void vmVariableSet (String vm, String variable, double value);
309 }