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
23 * Declare a new user variable associated to hosts with a color.
28 public final static native void hostVariableDeclareWithColor (String variable, String color);
32 * Add a value to a variable of a host.
38 public final static native void hostVariableAdd (String host, String variable, double value);
41 * Subtract a value from a variable of a host.
47 public final static native void hostVariableSub (String host, String variable, double value);
50 * Set the value of a variable of a host at a given timestamp.
57 public final static native void hostVariableSetWithTime (double time, String host, String variable, double value);
60 * Add a value to a variable of a host at a given timestamp.
67 public final static native void hostVariableAddWithTime (double time, String host, String variable, double value);
70 * Subtract a value from a variable of a host at a given timestamp.
77 public final static native void hostVariableSubWithTime (double time, String host, String variable, double value);
80 * Get declared user host variables.
83 public final static native String[] getHostVariablesName ();
86 * Declare a new user variable associated to links.
90 public final static native void linkVariableDeclare (String variable);
93 * Declare a new user variable associated to links with a color.
97 public final static native void linkVariableDeclareWithColor (String variable, String color);
100 * Set the value of a variable of a link.
106 public final static native void linkVariableSet (String link, String variable, double value);
109 * Add a value to a variable of a link.
115 public final static native void linkVariableAdd (String link, String variable, double value);
118 * Subtract a value from a variable of a link.
124 public final static native void linkVariableSub (String link, String variable, double value);
127 * Set the value of a variable of a link at a given timestamp.
134 public final static native void linkVariableSetWithTime (double time, String link, String variable, double value);
137 * Add a value to a variable of a link at a given timestamp.
144 public final static native void linkVariableAddWithTime (double time, String link, String variable, double value);
148 * Subtract a value from a variable of a link at a given timestamp.
155 public final static native void linkVariableSubWithTime (double time, String link, String variable, double value);
158 * Set the value of the variable present in the links connecting source and destination.
165 public final static native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
168 * Add a value to the variable present in the links connecting source and destination.
175 public final static native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
178 * Subtract a value from the variable present in the links connecting source and destination.
185 public final static native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
188 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
196 public final static native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
199 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
207 public final static native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
210 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
218 public final static native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
221 * Get declared user link variables.
223 public final static native String[] getLinkVariablesName ();
226 /* **** ******** WARNINGS ************** ***** */
227 /* Only the following routines have been */
228 /* JNI implemented - Adrien May, 22nd */
229 /* **** ******************************** ***** */
232 * Declare a user state that will be associated to hosts.
233 * A user host state can be used to trace application states.
235 * @param name The name of the new state to be declared.
237 public final static native void hostStateDeclare(String name);
240 * Declare a new value for a user state associated to hosts.
241 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
242 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
244 * @param state The name of the new state to be declared.
245 * @param value The name of the value
246 * @param color The color of the value
248 public final static native void hostStateDeclareValue (String state, String value, String color);
251 * Set the user state to the given value.
252 * (the queue is totally flushed and reinitialized with the given state).
254 * @param host The name of the host to be considered.
255 * @param state The name of the state previously declared.
256 * @param value The new value of the state.
258 public final static native void hostSetState (String host, String state, String value);
261 * Push a new value for a state of a given host.
263 * @param host The name of the host to be considered.
264 * @param state The name of the state previously declared.
265 * @param value The value to be pushed.
267 public final static native void hostPushState (String host, String state, String value);
270 * Pop the last value of a state of a given host.
272 * @param host The name of the host to be considered.
273 * @param state The name of the state to be popped.
275 public final static native void hostPopState (String host, String state);
278 * Declare a new user variable associated to hosts.
282 public final static native void hostVariableDeclare (String variable);
286 * Set the value of a variable of a host.
292 public final static native void hostVariableSet (String host, String variable, double value);
295 * Declare a new user variable associated to VMs.
299 public final static native void vmVariableDeclare (String variable);
303 * Set the value of a variable of a VM.
309 public final static native void vmVariableSet (String vm, String variable, double value);