1 package org.simgrid.trace;
4 * JNI interface to C code for the TRACES part of SimGrid.
6 * Copyright 2006,2007,2010,2011, 2012 The SimGrid Team.
9 * This program is free software; you can redistribute
10 * it and/or modify it under the terms of the license
11 * (GNU LGPL) which comes with this package.
14 public final class Trace {
15 /* Statically load the library which contains all native functions used in here */
18 System.loadLibrary("SG_java_tracing");
19 } catch(UnsatisfiedLinkError e) {
20 System.err.println("Cannot load the bindings to the simgrid library: ");
23 "Please check your LD_LIBRARY_PATH, or copy the simgrid and SG_java_tracing libraries to the current directory");
28 // TODO complete the binding of the tracing API
31 * Declare a new user variable associated to hosts.
35 public final static native void hostVariableDeclare (String variable);
38 * Declare a new user variable associated to hosts with a color.
43 public final static native void hostVariableDeclareWithColor (String variable, String color);
46 * Set the value of a variable of a host.
52 public final static native void hostVariableSet (String host, String variable, double value);
55 * Add a value to a variable of a host.
61 public final static native void hostVariableAdd (String host, String variable, double value);
64 * Subtract a value from a variable of a host.
70 public final static native void hostVariableSub (String host, String variable, double value);
73 * Set the value of a variable of a host at a given timestamp.
80 public final static native void hostVariableSetWithTime (double time, String host, String variable, double value);
83 * Add a value to a variable of a host at a given timestamp.
90 public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
93 * Subtract a value from a variable of a host at a given timestamp.
100 public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
103 * Get declared user host variables.
106 public final static native String[] getHostVariablesName ();
109 * Declare a new user variable associated to links.
113 public final static native void linkVariableDeclare (String variable);
116 * Declare a new user variable associated to links with a color.
120 public final static native void linkVariableDeclareWithColor (String variable, String color);
123 * Set the value of a variable of a link.
129 public final static native void linkVariableSet (String link, String variable, double value);
132 * Add a value to a variable of a link.
138 public final static native void linkVariableAdd (String link, String variable, double value);
141 * Subtract a value from a variable of a link.
147 public final static native void linkVariableSub (String link, String variable, double value);
150 * Set the value of a variable of a link at a given timestamp.
157 public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
160 * Add a value to a variable of a link at a given timestamp.
167 public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
171 * Subtract a value from a variable of a link at a given timestamp.
178 public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
181 * Set the value of the variable present in the links connecting source and destination.
188 public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
191 * Add a value to the variable present in the links connecting source and destination.
198 public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
201 * Subtract a value from the variable present in the links connecting source and destination.
208 public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
211 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
219 public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
222 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
230 public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
233 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
241 public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
244 * Get declared user link variables.
246 public final static native String[] getLinkVariablesName ();
249 /* **** ******** WARNINGS ************** ***** */
250 /* Only the following routines have been */
251 /* JNI implemented - Adrien May, 22nd */
252 /* **** ******************************** ***** */
255 * Declare a user state that will be associated to hosts.
256 * A user host state can be used to trace application states.
258 * @param name The name of the new state to be declared.
260 public final static native void hostStateDeclare(String name);
263 * Declare a new value for a user state associated to hosts.
264 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
265 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
267 * @param state The name of the new state to be declared.
268 * @param value The name of the value
269 * @param color The color of the value
271 public final static native void hostStateDeclareValue (String state, String value, String color);
274 * Set the user state to the given value.
275 * (the queue is totally flushed and reinitialized with the given state).
277 * @param host The name of the host to be considered.
278 * @param state The name of the state previously declared.
279 * @param value The new value of the state.
281 public final static native void hostSetState (String host, String state, String value);
284 * Push a new value for a state of a given host.
286 * @param host The name of the host to be considered.
287 * @param state The name of the state previously declared.
288 * @param value The value to be pushed.
290 public final static native void hostPushState (String host, String state, String value);
293 * Pop the last value of a state of a given host.
295 * @param host The name of the host to be considered.
296 * @param state The name of the state to be popped.
298 public final static native void hostPopState (String host, String state);