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 import org.simgrid.msg.Msg;
15 public final class Trace {
16 /* Statically load the library which contains all native functions used in here */
20 System.loadLibrary("SG_java_tracing");
21 } catch(UnsatisfiedLinkError e) {
22 System.err.println("Cannot load the bindings to the simgrid library: ");
25 "Please check your LD_LIBRARY_PATH, or copy the simgrid and SG_java_tracing libraries to the current directory");
30 // TODO complete the binding of the tracing API
34 * Declare a new user variable associated to hosts with a color.
39 public final static native void hostVariableDeclareWithColor (String variable, String color);
43 * Add a value to a variable of a host.
49 public final static native void hostVariableAdd (String host, String variable, double value);
52 * Subtract a value from a variable of a host.
58 public final static native void hostVariableSub (String host, String variable, double value);
61 * Set the value of a variable of a host at a given timestamp.
68 public final static native void hostVariableSetWithTime (double time, String host, String variable, double value);
71 * Add a value to a variable of a host at a given timestamp.
78 public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
81 * Subtract a value from a variable of a host at a given timestamp.
88 public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
91 * Get declared user host variables.
94 public final static native String[] getHostVariablesName ();
97 * Declare a new user variable associated to links.
101 public final static native void linkVariableDeclare (String variable);
104 * Declare a new user variable associated to links with a color.
108 public final static native void linkVariableDeclareWithColor (String variable, String color);
111 * Set the value of a variable of a link.
117 public final static native void linkVariableSet (String link, String variable, double value);
120 * Add a value to a variable of a link.
126 public final static native void linkVariableAdd (String link, String variable, double value);
129 * Subtract a value from a variable of a link.
135 public final static native void linkVariableSub (String link, String variable, double value);
138 * Set the value of a variable of a link at a given timestamp.
145 public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
148 * Add a value to a variable of a link at a given timestamp.
155 public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
159 * Subtract a value from a variable of a link at a given timestamp.
166 public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
169 * Set the value of the variable present in the links connecting source and destination.
176 public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
179 * Add a value to the variable present in the links connecting source and destination.
186 public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
189 * Subtract a value from the variable present in the links connecting source and destination.
196 public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
199 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
207 public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
210 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
218 public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
221 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
229 public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
232 * Get declared user link variables.
234 public final static native String[] getLinkVariablesName ();
237 /* **** ******** WARNINGS ************** ***** */
238 /* Only the following routines have been */
239 /* JNI implemented - Adrien May, 22nd */
240 /* **** ******************************** ***** */
243 * Declare a user state that will be associated to hosts.
244 * A user host state can be used to trace application states.
246 * @param name The name of the new state to be declared.
248 public final static native void hostStateDeclare(String name);
251 * Declare a new value for a user state associated to hosts.
252 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
253 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
255 * @param state The name of the new state to be declared.
256 * @param value The name of the value
257 * @param color The color of the value
259 public final static native void hostStateDeclareValue (String state, String value, String color);
262 * Set the user state to the given value.
263 * (the queue is totally flushed and reinitialized with the given state).
265 * @param host The name of the host to be considered.
266 * @param state The name of the state previously declared.
267 * @param value The new value of the state.
269 public final static native void hostSetState (String host, String state, String value);
272 * Push a new value for a state of a given host.
274 * @param host The name of the host to be considered.
275 * @param state The name of the state previously declared.
276 * @param value The value to be pushed.
278 public final static native void hostPushState (String host, String state, String value);
281 * Pop the last value of a state of a given host.
283 * @param host The name of the host to be considered.
284 * @param state The name of the state to be popped.
286 public final static native void hostPopState (String host, String state);
289 * Declare a new user variable associated to hosts.
293 public final static native void hostVariableDeclare (String variable);
297 * Set the value of a variable of a host.
303 public final static native void hostVariableSet (String host, String variable, double value);
306 * Declare a new user variable associated to VMs.
310 public final static native void vmVariableDeclare (String variable);
314 * Set the value of a variable of a VM.
320 public final static native void vmVariableSet (String vm, String variable, double value);