2 * JNI interface to C code for the TRACES part of SimGrid.
4 * Copyright 2012 The SimGrid Team.
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.
11 package org.simgrid.trace;
13 public final class Trace {
14 /* Statically load the library which contains all native functions used in here */
17 System.loadLibrary("SG_java_tracing");
18 } catch(UnsatisfiedLinkError e) {
19 System.err.println("Cannot load the bindings to the simgrid library: ");
22 "Please check your LD_LIBRARY_PATH, or copy the simgrid and SG_java_tracing libraries to the current directory");
27 // TODO complete the binding of the tracing API
31 * Declare a new user variable associated to hosts with a color.
36 public final static native void hostVariableDeclareWithColor (String variable, String color);
40 * Add a value to a variable of a host.
46 public final static native void hostVariableAdd (String host, String variable, double value);
49 * Subtract a value from a variable of a host.
55 public final static native void hostVariableSub (String host, String variable, double value);
58 * Set the value of a variable of a host at a given timestamp.
65 public final static native void hostVariableSetWithTime (double time, String host, String variable, double value);
68 * Add a value to a variable of a host at a given timestamp.
75 public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
78 * Subtract a value from a variable of a host at a given timestamp.
85 public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
88 * Get declared user host variables.
91 public final static native String[] getHostVariablesName ();
94 * Declare a new user variable associated to links.
98 public final static native void linkVariableDeclare (String variable);
101 * Declare a new user variable associated to links with a color.
105 public final static native void linkVariableDeclareWithColor (String variable, String color);
108 * Set the value of a variable of a link.
114 public final static native void linkVariableSet (String link, String variable, double value);
117 * Add a value to a variable of a link.
123 public final static native void linkVariableAdd (String link, String variable, double value);
126 * Subtract a value from a variable of a link.
132 public final static native void linkVariableSub (String link, String variable, double value);
135 * Set the value of a variable of a link at a given timestamp.
142 public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
145 * Add a value to a variable of a link at a given timestamp.
152 public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
156 * Subtract a value from a variable of a link at a given timestamp.
163 public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
166 * Set the value of the variable present in the links connecting source and destination.
173 public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
176 * Add a value to the variable present in the links connecting source and destination.
183 public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
186 * Subtract a value from the variable present in the links connecting source and destination.
193 public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
196 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
204 public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
207 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
215 public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
218 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
226 public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
229 * Get declared user link variables.
231 public final static native String[] getLinkVariablesName ();
234 /* **** ******** WARNINGS ************** ***** */
235 /* Only the following routines have been */
236 /* JNI implemented - Adrien May, 22nd */
237 /* **** ******************************** ***** */
240 * Declare a user state that will be associated to hosts.
241 * A user host state can be used to trace application states.
243 * @param name The name of the new state to be declared.
245 public final static native void hostStateDeclare(String name);
248 * Declare a new value for a user state associated to hosts.
249 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
250 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
252 * @param state The name of the new state to be declared.
253 * @param value The name of the value
254 * @param color The color of the value
256 public final static native void hostStateDeclareValue (String state, String value, String color);
259 * Set the user state to the given value.
260 * (the queue is totally flushed and reinitialized with the given state).
262 * @param host The name of the host to be considered.
263 * @param state The name of the state previously declared.
264 * @param value The new value of the state.
266 public final static native void hostSetState (String host, String state, String value);
269 * Push a new value for a state of a given host.
271 * @param host The name of the host to be considered.
272 * @param state The name of the state previously declared.
273 * @param value The value to be pushed.
275 public final static native void hostPushState (String host, String state, String value);
278 * Pop the last value of a state of a given host.
280 * @param host The name of the host to be considered.
281 * @param state The name of the state to be popped.
283 public final static native void hostPopState (String host, String state);
286 * Declare a new user variable associated to hosts.
290 public final static native void hostVariableDeclare (String variable);
294 * Set the value of a variable of a host.
300 public final static native void hostVariableSet (String host, String variable, double value);
303 * Declare a new user variable associated to VMs.
307 public final static native void vmVariableDeclare (String variable);
311 * Set the value of a variable of a VM.
317 public final static native void vmVariableSet (String vm, String variable, double value);