1 /* JNI interface to C code for the TRACES part of SimGrid. */
3 /* Copyright (c) 2012-2014. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 package org.simgrid.trace;
11 import org.simgrid.NativeLib;
13 public final class Trace {
14 /* Statically load the library which contains all native functions used in here */
16 NativeLib.nativeInit();
19 // TODO complete the binding of the tracing API
22 * Declare a new user variable associated to hosts with a color.
27 public static final native void hostVariableDeclareWithColor (String variable, String color);
30 * Add a value to a variable of a host.
36 public static final native void hostVariableAdd (String host, String variable, double value);
39 * Subtract a value from a variable of a host.
45 public static final native void hostVariableSub (String host, String variable, double value);
48 * Set the value of a variable of a host at a given timestamp.
55 public static final native void hostVariableSetWithTime (double time, String host, String variable, double value);
58 * Add a value to a variable of a host at a given timestamp.
65 public static final native void hostVariableAddWithTime (double time, String host, String variable, double value);
68 * Subtract a value from a variable of a host at a given timestamp.
75 public static final native void hostVariableSubWithTime (double time, String host, String variable, double value);
78 * Get declared user host variables.
81 public static final native String[] getHostVariablesName ();
84 * Declare a new user variable associated to links.
88 public static final native void linkVariableDeclare (String variable);
91 * Declare a new user variable associated to links with a color.
95 public static final native void linkVariableDeclareWithColor (String variable, String color);
98 * Set the value of a variable of a link.
104 public static final native void linkVariableSet (String link, String variable, double value);
107 * Add a value to a variable of a link.
113 public static final native void linkVariableAdd (String link, String variable, double value);
116 * Subtract a value from a variable of a link.
122 public static final native void linkVariableSub (String link, String variable, double value);
125 * Set the value of a variable of a link at a given timestamp.
132 public static final native void linkVariableSetWithTime (double time, String link, String variable, double value);
135 * Add a value to a variable of a link at a given timestamp.
142 public static final native void linkVariableAddWithTime (double time, String link, String variable, double value);
145 * Subtract a value from a variable of a link at a given timestamp.
152 public static final native void linkVariableSubWithTime (double time, String link, String variable, double value);
155 * Set the value of the variable present in the links connecting source and destination.
162 public static final native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
165 * Add a value to the variable present in the links connecting source and destination.
172 public static final native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
175 * Subtract a value from the variable present in the links connecting source and destination.
182 public static final native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
185 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
193 public static final native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
196 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
204 public static final native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
207 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
215 public static final native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
218 * Get declared user link variables.
220 public static final native String[] getLinkVariablesName ();
223 /* **** ******** WARNINGS ************** ***** */
224 /* Only the following routines have been */
225 /* JNI implemented - Adrien May, 22nd */
226 /* **** ******************************** ***** */
229 * Declare a user state that will be associated to hosts.
230 * A user host state can be used to trace application states.
232 * @param name The name of the new state to be declared.
234 public static final native void hostStateDeclare(String name);
237 * Declare a new value for a user state associated to hosts.
238 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
239 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
241 * @param state The name of the new state to be declared.
242 * @param value The name of the value
243 * @param color The color of the value
245 public static final native void hostStateDeclareValue (String state, String value, String color);
248 * Set the user state to the given value.
249 * (the queue is totally flushed and reinitialized with the given state).
251 * @param host The name of the host to be considered.
252 * @param state The name of the state previously declared.
253 * @param value The new value of the state.
255 public static final native void hostSetState (String host, String state, String value);
258 * Push a new value for a state of a given host.
260 * @param host The name of the host to be considered.
261 * @param state The name of the state previously declared.
262 * @param value The value to be pushed.
264 public static final native void hostPushState (String host, String state, String value);
267 * Pop the last value of a state of a given host.
269 * @param host The name of the host to be considered.
270 * @param state The name of the state to be popped.
272 public static final native void hostPopState (String host, String state);
275 * Declare a new user variable associated to hosts.
279 public static final native void hostVariableDeclare (String variable);
282 * Set the value of a variable of a host.
288 public static final native void hostVariableSet (String host, String variable, double value);
291 * Declare a new user variable associated to VMs.
295 public static final native void vmVariableDeclare (String variable);
298 * Set the value of a variable of a VM.
304 public static final native void vmVariableSet (String vm, String variable, double value);