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
30 * Declare a new user variable associated to hosts.
34 public final static native void hostVariableDeclare (String variable);
37 * Declare a new user variable associated to hosts with a color.
42 public final static native void hostVariableDeclareWithColor (String variable, String color);
45 * Set the value of a variable of a host.
51 public final static native void hostVariableSet (String host, String variable, double value);
54 * Add a value to a variable of a host.
60 public final static native void hostVariableAdd (String host, String variable, double value);
63 * Subtract a value from a variable of a host.
69 public final static native void hostVariableSub (String host, String variable, double value);
72 * Set the value of a variable of a host at a given timestamp.
79 public final static native void hostVariableSetWithTime (double time, String host, String variable, double value);
82 * Add a value to a variable of a host at a given timestamp.
89 public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
92 * Subtract a value from a variable of a host at a given timestamp.
99 public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
102 * Get declared user host variables.
105 public final static native String[] getHostVariablesName ();
108 * Declare a new user variable associated to links.
112 public final static native void linkVariableDeclare (String variable);
115 * Declare a new user variable associated to links with a color.
119 public final static native void linkVariableDeclareWithColor (String variable, String color);
122 * Set the value of a variable of a link.
128 public final static native void linkVariableSet (String link, String variable, double value);
131 * Add a value to a variable of a link.
137 public final static native void linkVariableAdd (String link, String variable, double value);
140 * Subtract a value from a variable of a link.
146 public final static native void linkVariableSub (String link, String variable, double value);
149 * Set the value of a variable of a link at a given timestamp.
156 public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
159 * Add a value to a variable of a link at a given timestamp.
166 public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
170 * Subtract a value from a variable of a link at a given timestamp.
177 public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
180 * Set the value of the variable present in the links connecting source and destination.
187 public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
190 * Add a value to the variable present in the links connecting source and destination.
197 public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
200 * Subtract a value from the variable present in the links connecting source and destination.
207 public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
210 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
218 public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
221 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
229 public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
232 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
240 public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
243 * Get declared user link variables.
245 public final static native String[] getLinkVariablesName ();
248 /* **** ******** WARNINGS ************** ***** */
249 /* Only the following routines have been */
250 /* JNI implemented - Adrien May, 22nd */
251 /* **** ******************************** ***** */
254 * Declare a user state that will be associated to hosts.
255 * A user host state can be used to trace application states.
257 * @param name The name of the new state to be declared.
259 public final static native void hostStateDeclare(String name);
262 * Declare a new value for a user state associated to hosts.
263 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
264 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
266 * @param state The name of the new state to be declared.
267 * @param value The name of the value
268 * @param color The color of the value
270 public final static native void hostStateDeclareValue (String state, String value, String color);
273 * Set the user state to the given value.
274 * (the queue is totally flushed and reinitialized with the given state).
276 * @param host The name of the host to be considered.
277 * @param state The name of the state previously declared.
278 * @param value The new value of the state.
280 public final static native void hostSetState (String host, String state, String value);
283 * Push a new value for a state of a given host.
285 * @param host The name of the host to be considered.
286 * @param state The name of the state previously declared.
287 * @param value The value to be pushed.
289 public final static native void hostPushState (String host, String state, String value);
292 * Pop the last value of a state of a given host.
294 * @param host The name of the host to be considered.
295 * @param state The name of the state to be popped.
297 public final static native void hostPopState (String host, String state);