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 */
21 // TODO complete the binding of the tracing API
25 * Declare a new user variable associated to hosts with a color.
30 public final static native void hostVariableDeclareWithColor (String variable, String color);
34 * Add a value to a variable of a host.
40 public final static native void hostVariableAdd (String host, String variable, double value);
43 * Subtract a value from a variable of a host.
49 public final static native void hostVariableSub (String host, String variable, double value);
52 * Set the value of a variable of a host at a given timestamp.
59 public final static native void hostVariableSetWithTime (double time, String host, String variable, double value);
62 * Add a value to a variable of a host at a given timestamp.
69 public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
72 * Subtract a value from a variable of a host at a given timestamp.
79 public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
82 * Get declared user host variables.
85 public final static native String[] getHostVariablesName ();
88 * Declare a new user variable associated to links.
92 public final static native void linkVariableDeclare (String variable);
95 * Declare a new user variable associated to links with a color.
99 public final static native void linkVariableDeclareWithColor (String variable, String color);
102 * Set the value of a variable of a link.
108 public final static native void linkVariableSet (String link, String variable, double value);
111 * Add a value to a variable of a link.
117 public final static native void linkVariableAdd (String link, String variable, double value);
120 * Subtract a value from a variable of a link.
126 public final static native void linkVariableSub (String link, String variable, double value);
129 * Set the value of a variable of a link at a given timestamp.
136 public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
139 * Add a value to a variable of a link at a given timestamp.
146 public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
150 * Subtract a value from a variable of a link at a given timestamp.
157 public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
160 * Set the value of the variable present in the links connecting source and destination.
167 public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
170 * Add a value to the variable present in the links connecting source and destination.
177 public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
180 * Subtract a value from the variable present in the links connecting source and destination.
187 public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
190 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
198 public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
201 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
209 public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
212 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
220 public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
223 * Get declared user link variables.
225 public final static native String[] getLinkVariablesName ();
228 /* **** ******** WARNINGS ************** ***** */
229 /* Only the following routines have been */
230 /* JNI implemented - Adrien May, 22nd */
231 /* **** ******************************** ***** */
234 * Declare a user state that will be associated to hosts.
235 * A user host state can be used to trace application states.
237 * @param name The name of the new state to be declared.
239 public final static native void hostStateDeclare(String name);
242 * Declare a new value for a user state associated to hosts.
243 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
244 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
246 * @param state The name of the new state to be declared.
247 * @param value The name of the value
248 * @param color The color of the value
250 public final static native void hostStateDeclareValue (String state, String value, String color);
253 * Set the user state to the given value.
254 * (the queue is totally flushed and reinitialized with the given state).
256 * @param host The name of the host to be considered.
257 * @param state The name of the state previously declared.
258 * @param value The new value of the state.
260 public final static native void hostSetState (String host, String state, String value);
263 * Push a new value for a state of a given host.
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 value to be pushed.
269 public final static native void hostPushState (String host, String state, String value);
272 * Pop the last value of 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 to be popped.
277 public final static native void hostPopState (String host, String state);
280 * Declare a new user variable associated to hosts.
284 public final static native void hostVariableDeclare (String variable);
288 * Set the value of a variable of a host.
294 public final static native void hostVariableSet (String host, String variable, double value);
297 * Declare a new user variable associated to VMs.
301 public final static native void vmVariableDeclare (String variable);
305 * Set the value of a variable of a VM.
311 public final static native void vmVariableSet (String vm, String variable, double value);