1 /* JNI interface to C code for the TRACES part of SimGrid. */
3 /* Copyright (c) 2012-2023. 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();
20 throw new IllegalStateException("Utility class \"Trace\"");
23 // TODO complete the binding of the tracing API
26 * Declare a new user variable associated to hosts with a color.
31 public static final native void hostVariableDeclareWithColor (String variable, String color);
34 * Add a value to a variable of a host.
40 public static final native void hostVariableAdd (String host, String variable, double value);
43 * Subtract a value from a variable of a host.
49 public static final 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 static final 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 static final 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 static final native void hostVariableSubWithTime (double time, String host, String variable, double value);
82 * Get declared user host variables.
85 public static final native String[] getHostVariablesName ();
88 * Declare a new user variable associated to links.
92 public static final native void linkVariableDeclare (String variable);
95 * Declare a new user variable associated to links with a color.
99 public static final native void linkVariableDeclareWithColor (String variable, String color);
102 * Set the value of a variable of a link.
108 public static final native void linkVariableSet (String link, String variable, double value);
111 * Add a value to a variable of a link.
117 public static final native void linkVariableAdd (String link, String variable, double value);
120 * Subtract a value from a variable of a link.
126 public static final 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 static final 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 static final native void linkVariableAddWithTime (double time, String link, String variable, double value);
149 * Subtract a value from a variable of a link at a given timestamp.
156 public static final native void linkVariableSubWithTime (double time, String link, String variable, double value);
159 * Set the value of the variable present in the links connecting source and destination.
166 public static final native void linkSrcDstVariableSet (String src, String dst, String variable, double value);
169 * Add a value to the variable present in the links connecting source and destination.
176 public static final native void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
179 * Subtract a value from the variable present in the links connecting source and destination.
186 public static final native void linkSrcDstVariableSub (String src, String dst, String variable, double value);
189 * Set the value of the variable present in the links connecting source and destination at a given timestamp.
197 public static final native void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
200 * Add a value to the variable present in the links connecting source and destination at a given timestamp.
208 public static final native void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
211 * Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
219 public static final native void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
222 * Get declared user link variables.
224 public static final native String[] getLinkVariablesName ();
227 /* **** ******** WARNINGS ************** ***** */
228 /* Only the following routines have been */
229 /* JNI implemented - Adrien May, 22nd */
230 /* **** ******************************** ***** */
233 * Declare a user state that will be associated to hosts.
234 * A user host state can be used to trace application states.
236 * @param name The name of the new state to be declared.
238 public static final native void hostStateDeclare(String name);
241 * Declare a new value for a user state associated to hosts.
242 * The color needs to be a string with three numbers separated by spaces in the range [0,1].
243 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
245 * @param state The name of the new state to be declared.
246 * @param value The name of the value
247 * @param color The color of the value
249 public static final native void hostStateDeclareValue (String state, String value, String color);
252 * Set the user state to the given value.
253 * (the queue is totally flushed and reinitialized with the given state).
255 * @param host The name of the host to be considered.
256 * @param state The name of the state previously declared.
257 * @param value The new value of the state.
259 public static final native void hostSetState (String host, String state, String value);
262 * Push a new value for a state of a given host.
264 * @param host The name of the host to be considered.
265 * @param state The name of the state previously declared.
266 * @param value The value to be pushed.
268 public static final native void hostPushState (String host, String state, String value);
271 * Pop the last value of a state of a given host.
273 * @param host The name of the host to be considered.
274 * @param state The name of the state to be popped.
276 public static final native void hostPopState (String host, String state);
279 * Declare a new user variable associated to hosts.
283 public static final native void hostVariableDeclare (String variable);
286 * Set the value of a variable of a host.
292 public static final native void hostVariableSet (String host, String variable, double value);
295 * Declare a new user variable associated to VMs.
299 public static final native void vmVariableDeclare (String variable);
302 * Set the value of a variable of a VM.
308 public static final native void vmVariableSet (String vm, String variable, double value);