Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] documentation for all the trace user variables API
[simgrid.git] / src / instr / instr_interface.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5   * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "simgrid_config.h"
8
9 #ifdef HAVE_TRACING
10 #include "instr/instr_private.h"
11 #include "surf/network_private.h"
12
13 typedef enum {
14   INSTR_US_DECLARE,
15   INSTR_US_SET,
16   INSTR_US_ADD,
17   INSTR_US_SUB
18 } InstrUserVariable;
19
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
21
22 /** \ingroup TRACE_category
23  *  \brief Declare a new category with a random color.
24  *
25  *  This function should be used to define a user category. The
26  *  category can be used to differentiate the tasks that are created
27  *  during the simulation (for example, tasks from server1, server2,
28  *  or request tasks, computation tasks, communication tasks). All
29  *  resource utilization (host power and link bandwidth) will be
30  *  classified according to the task category. Tasks that do not
31  *  belong to a category are not traced. The color for the category
32  *  that is being declared is random. This function has no effect
33  *  if a category with the same name has been already declared.
34  *
35  * See \ref tracing_tracing for details on how to trace
36  * the (categorized) resource utilization.
37  *
38  *  \param category The name of the new tracing category to be created.
39  *
40  *  \see TRACE_category_with_color, MSG_task_set_category
41  */
42 void TRACE_category(const char *category)
43 {
44   TRACE_category_with_color (category, NULL);
45 }
46
47 /** \ingroup TRACE_category
48  *  \brief Declare a new category with a color.
49  *
50  *  Same as #TRACE_category, but let user specify a color encoded as a
51  *  RGB-like string with three floats from 0 to 1. So, to specify a
52  *  red color, pass "1 0 0" as color parameter. A light-gray color
53  *  can be specified using "0.7 0.7 0.7" as color. This function has
54  *  no effect if a category with the same name has been already declared.
55  *
56  * See \ref tracing_tracing for details on how to trace
57  * the (categorized) resource utilization.
58  *
59  *  \param category The name of the new tracing category to be created.
60  *  \param color The color of the category (see \ref tracing_tracing to
61  *  know how to correctly specify the color)
62  *
63  *  \see MSG_task_set_category
64  */
65 void TRACE_category_with_color (const char *category, const char *color)
66 {
67   /* safe switch */
68   if (!TRACE_is_enabled()) return;
69
70   if (!(TRACE_categorized() && category != NULL)) return;
71
72   /* if platform is not traced, we can't deal with categories */
73   if (!TRACE_needs_platform()) return;
74
75   //check if category is already created
76   char *created = xbt_dict_get_or_null(created_categories, category);
77   if (created) return;
78   xbt_dict_set (created_categories, category, xbt_strdup("1"), NULL);
79
80   //define final_color
81   char final_color[INSTR_DEFAULT_STR_SIZE];
82   if (!color){
83     //generate a random color
84     double red = drand48();
85     double green = drand48();
86     double blue = drand48();
87     snprintf (final_color, INSTR_DEFAULT_STR_SIZE, "%f %f %f", red, green, blue);
88   }else{
89     snprintf (final_color, INSTR_DEFAULT_STR_SIZE, "%s", color);
90   }
91
92   XBT_DEBUG("CAT,declare %s, %s", category, final_color);
93
94   //define the type of this category on top of hosts and links
95   instr_new_variable_type (category, final_color);
96 }
97
98 /** \ingroup TRACE_mark
99  * \brief Declare a new type for tracing mark.
100  *
101  * This function declares a new Paje event
102  * type in the trace file that can be used by
103  * simulators to declare application-level
104  * marks. This function is independent of
105  * which API is used in SimGrid.
106  *
107  * \param mark_type The name of the new type.
108  *
109  * \see TRACE_mark
110  */
111 void TRACE_declare_mark(const char *mark_type)
112 {
113   /* safe switch */
114   if (!TRACE_is_enabled()) return;
115
116   if (!mark_type) return;
117
118   XBT_DEBUG("MARK,declare %s", mark_type);
119   PJ_type_event_new(mark_type, NULL, PJ_type_get_root());
120 }
121
122 /**
123  * \ingroup TRACE_mark
124  * \brief Create a new instance of a tracing mark type.
125  *
126  * This function creates a mark in the trace file. The
127  * first parameter had to be previously declared using
128  * #TRACE_declare_mark, the second is the identifier
129  * for this mark instance. We recommend that the
130  * mark_value is a unique value for the whole simulation.
131  * Nevertheless, this is not a strong requirement: the
132  * trace will be valid even if there are multiple mark
133  * identifiers for the same trace.
134  *
135  * \param mark_type The name of the type for which the new instance will belong.
136  * \param mark_value The name of the new instance mark.
137  *
138  * \see TRACE_declare_mark
139  */
140 void TRACE_mark(const char *mark_type, const char *mark_value)
141 {
142   /* safe switch */
143   if (!TRACE_is_enabled()) return;
144
145   if (!mark_type || !mark_value) return;
146
147   XBT_DEBUG("MARK %s %s", mark_type, mark_value);
148   type_t type = PJ_type_get (mark_type, PJ_type_get_root());
149   if (type == NULL){
150     THROWF (tracing_error, 1, "mark_type with name (%s) not declared before", mark_type);
151   }
152   val_t value = PJ_value_get (mark_value, type);
153   if (value == NULL){
154     value = PJ_value_new (mark_value, NULL, type);
155   }
156   new_pajeNewEvent (MSG_get_clock(), PJ_container_get_root(), type, value);
157 }
158
159 static void instr_user_variable(double time,
160                          const char *resource,
161                          const char *variable,
162                          const char *father_type,
163                          double value,
164                          InstrUserVariable what,
165                          const char *color)
166 {
167   /* safe switch */
168   if (!TRACE_is_enabled()) return;
169
170   /* if platform is not traced, we can't deal user variables */
171   if (!TRACE_needs_platform()) return;
172
173   char valuestr[100];
174   snprintf(valuestr, 100, "%g", value);
175
176   switch (what){
177   case INSTR_US_DECLARE:
178     instr_new_user_variable_type (father_type, variable, color);
179     break;
180   case INSTR_US_SET:
181   {
182     container_t container = PJ_container_get(resource);
183     type_t type = PJ_type_get (variable, container->type);
184     new_pajeSetVariable(time, container, type, value);
185     break;
186   }
187   case INSTR_US_ADD:
188   {
189     container_t container = PJ_container_get(resource);
190     type_t type = PJ_type_get (variable, container->type);
191     new_pajeAddVariable(time, container, type, value);
192     break;
193   }
194   case INSTR_US_SUB:
195   {
196     container_t container = PJ_container_get(resource);
197     type_t type = PJ_type_get (variable, container->type);
198     new_pajeSubVariable(time, container, type, value);
199     break;
200   }
201   default:
202     //TODO: launch exception
203     break;
204   }
205 }
206
207 static void instr_user_srcdst_variable(double time,
208                               const char *src,
209                               const char *dst,
210                               const char *variable,
211                               const char *father_type,
212                               double value,
213                               InstrUserVariable what)
214 {
215   xbt_dynar_t route=NULL;
216   network_element_t src_elm = xbt_lib_get_or_null(host_lib,src,ROUTING_HOST_LEVEL);
217   if(!src_elm) src_elm = xbt_lib_get_or_null(as_router_lib,src,ROUTING_ASR_LEVEL);
218   if(!src_elm) xbt_die("Element '%s' not found!",src);
219
220   network_element_t dst_elm = xbt_lib_get_or_null(host_lib,dst,ROUTING_HOST_LEVEL);
221   if(!dst_elm) dst_elm = xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
222   if(!dst_elm) xbt_die("Element '%s' not found!",dst);
223
224   routing_get_route_and_latency (src_elm, dst_elm, &route,NULL);
225   unsigned int i;
226   void *link;
227   xbt_dynar_foreach (route, i, link) {
228     char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
229     instr_user_variable (time, link_name, variable, father_type, value, what, NULL);
230   }
231 }
232
233 int TRACE_platform_graph_export_graphviz (const char *filename)
234 {
235   /* returns 1 if successful, 0 otherwise */
236   if (!TRACE_is_enabled()) return 0;
237   xbt_graph_t g = instr_routing_platform_graph();
238   if (g == NULL) return 0;
239   instr_routing_platform_graph_export_graphviz (g, filename);
240   xbt_graph_free_graph (g, xbt_free, xbt_free, NULL);
241   return 1;
242 }
243
244 /*
245  * Derived functions that use instr_user_variable and TRACE_user_srcdst_variable.
246  * They were previously defined as pre-processors directives, but were transformed
247  * into functions so the user can track them using gdb.
248  */
249
250 /* for host variables */
251 /** \ingroup TRACE_user_variables
252  *  \brief Declare a new user variable associated to hosts.
253  *
254  *  Declare a user variable that will be associated to hosts.
255  *  A user host variable can be used to trace user variables
256  *  such as the number of tasks in a server, the number of
257  *  clients in an application (for hosts), and so on. The color
258  *  associated to this new variable will be random.
259  *
260  *  \param variable The name of the new variable to be declared.
261  *
262  *  \see TRACE_host_variable_declare_with_color
263  */
264 void TRACE_host_variable_declare (const char *variable)
265 {
266   instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, NULL);
267 }
268
269 /** \ingroup TRACE_user_variables
270  *  \brief Declare a new user variable associated to hosts with a color.
271  *
272  *  Same as #TRACE_host_variable_declare, but associated a color
273  *  to the newly created user host variable. The color needs to be
274  *  a string with three numbers separated by spaces in the range [0,1].
275  *  A light-gray color can be specified using "0.7 0.7 0.7" as color.
276  *
277  *  \param variable The name of the new variable to be declared.
278  *  \param color The color for the new variable.
279  *
280  */
281 void TRACE_host_variable_declare_with_color (const char *variable, const char *color)
282 {
283   instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, color);
284 }
285
286 /** \ingroup TRACE_user_variables
287  *  \brief Set the value of a variable of a host.
288  *
289  *  \param host The name of the host to be considered.
290  *  \param variable The name of the variable to be considered.
291  *  \param value The new value of the variable.
292  *
293  *  \see TRACE_host_variable_declare, TRACE_host_variable_add, TRACE_host_variable_sub
294  */
295 void TRACE_host_variable_set (const char *host, const char *variable, double value)
296 {
297   TRACE_host_variable_set_with_time (MSG_get_clock(), host, variable, value);
298 }
299
300 /** \ingroup TRACE_user_variables
301  *  \brief Add a value to a variable of a host.
302  *
303  *  \param host The name of the host to be considered.
304  *  \param variable The name of the variable to be considered.
305  *  \param value The value to be added to the variable.
306  *
307  *  \see TRACE_host_variable_declare, TRACE_host_variable_set, TRACE_host_variable_sub
308  */
309 void TRACE_host_variable_add (const char *host, const char *variable, double value)
310 {
311   TRACE_host_variable_add_with_time (MSG_get_clock(), host, variable, value);
312 }
313
314 /** \ingroup TRACE_user_variables
315  *  \brief Subtract a value from a variable of a host.
316  *
317  *  \param host The name of the host to be considered.
318  *  \param variable The name of the variable to be considered.
319  *  \param value The value to be subtracted from the variable.
320  *
321  *  \see TRACE_host_variable_declare, TRACE_host_variable_set, TRACE_host_variable_add
322  */
323 void TRACE_host_variable_sub (const char *host, const char *variable, double value)
324 {
325   TRACE_host_variable_sub_with_time (MSG_get_clock(), host, variable, value);
326 }
327
328 /** \ingroup TRACE_user_variables
329  *  \brief Set the value of a variable of a host at a given timestamp.
330  *
331  *  Same as #TRACE_host_variable_set, but let user specify
332  *  the time used to trace it. Users can specify a time that
333  *  is not the simulated clock time as defined by the core
334  *  simulator. This allows a fine-grain control of time
335  *  definition, but should be used with caution since the trace
336  *  can be inconsistent if resource utilization traces are also traced.
337  *
338  *  \param time The timestamp to be used to tag this change of value.
339  *  \param host The name of the host to be considered.
340  *  \param variable The name of the variable to be considered.
341  *  \param value The new value of the variable.
342  *
343  *  \see TRACE_host_variable_declare, TRACE_host_variable_add_with_time, TRACE_host_variable_sub_with_time
344  */
345 void TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value)
346 {
347   instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, NULL);
348 }
349
350 /** \ingroup TRACE_user_variables
351  *  \brief Add a value to a variable of a host at a given timestamp.
352  *
353  *  Same as #TRACE_host_variable_add, but let user specify
354  *  the time used to trace it. Users can specify a time that
355  *  is not the simulated clock time as defined by the core
356  *  simulator. This allows a fine-grain control of time
357  *  definition, but should be used with caution since the trace
358  *  can be inconsistent if resource utilization traces are also traced.
359  *
360  *  \param time The timestamp to be used to tag this change of value.
361  *  \param host The name of the host to be considered.
362  *  \param variable The name of the variable to be considered.
363  *  \param value The value to be added to the variable.
364  *
365  *  \see TRACE_host_variable_declare, TRACE_host_variable_set_with_time, TRACE_host_variable_sub_with_time
366  */
367 void TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value)
368 {
369   instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, NULL);
370 }
371
372 /** \ingroup TRACE_user_variables
373  *  \brief Subtract a value from a variable of a host at a given timestamp.
374  *
375  *  Same as #TRACE_host_variable_sub, but let user specify
376  *  the time used to trace it. Users can specify a time that
377  *  is not the simulated clock time as defined by the core
378  *  simulator. This allows a fine-grain control of time
379  *  definition, but should be used with caution since the trace
380  *  can be inconsistent if resource utilization traces are also traced.
381  *
382  *  \param time The timestamp to be used to tag this change of value.
383  *  \param host The name of the host to be considered.
384  *  \param variable The name of the variable to be considered.
385  *  \param value The value to be subtracted from the variable.
386  *
387  *  \see TRACE_host_variable_declare, TRACE_host_variable_set_with_time, TRACE_host_variable_add_with_time
388  */
389 void TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value)
390 {
391   instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, NULL);
392 }
393
394 /* for link variables */
395 /** \ingroup TRACE_user_variables
396  *  \brief Declare a new user variable associated to links.
397  *
398  *  Declare a user variable that will be associated to links.
399  *  A user link variable can be used, for example, to trace
400  *  user variables such as the number of messages being
401  *  transferred through network links. The color
402  *  associated to this new variable will be random.
403  *
404  *  \param variable The name of the new variable to be declared.
405  *
406  *  \see TRACE_link_variable_declare_with_color
407  */
408 void TRACE_link_variable_declare (const char *variable)
409 {
410   instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, NULL);
411 }
412
413 /** \ingroup TRACE_user_variables
414  *  \brief Declare a new user variable associated to links with a color.
415  *
416  *  Same as #TRACE_link_variable_declare, but associated a color
417  *  to the newly created user link variable. The color needs to be
418  *  a string with three numbers separated by spaces in the range [0,1].
419  *  A light-gray color can be specified using "0.7 0.7 0.7" as color.
420  *
421  *  \param variable The name of the new variable to be declared.
422  *  \param color The color for the new variable.
423  *
424  */
425 void TRACE_link_variable_declare_with_color (const char *variable, const char *color)
426 {
427   instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, color);
428 }
429
430 /** \ingroup TRACE_user_variables
431  *  \brief Set the value of a variable of a link.
432  *
433  *  \param link The name of the link to be considered.
434  *  \param variable The name of the variable to be considered.
435  *  \param value The new value of the variable.
436  *
437  *  \see TRACE_link_variable_declare, TRACE_link_variable_add, TRACE_link_variable_sub
438  */
439 void TRACE_link_variable_set (const char *link, const char *variable, double value)
440 {
441   TRACE_link_variable_set_with_time (MSG_get_clock(), link, variable, value);
442 }
443
444 /** \ingroup TRACE_user_variables
445  *  \brief Add a value to a variable of a link.
446  *
447  *  \param link The name of the link to be considered.
448  *  \param variable The name of the variable to be considered.
449  *  \param value The value to be added to the variable.
450  *
451  *  \see TRACE_link_variable_declare, TRACE_link_variable_set, TRACE_link_variable_sub
452  */
453 void TRACE_link_variable_add (const char *link, const char *variable, double value)
454 {
455   TRACE_link_variable_add_with_time (MSG_get_clock(), link, variable, value);
456 }
457
458 /** \ingroup TRACE_user_variables
459  *  \brief Subtract a value from a variable of a link.
460  *
461  *  \param link The name of the link to be considered.
462  *  \param variable The name of the variable to be considered.
463  *  \param value The value to be subtracted from the variable.
464  *
465  *  \see TRACE_link_variable_declare, TRACE_link_variable_set, TRACE_link_variable_add
466  */
467 void TRACE_link_variable_sub (const char *link, const char *variable, double value)
468 {
469   TRACE_link_variable_sub_with_time (MSG_get_clock(), link, variable, value);
470 }
471
472 /** \ingroup TRACE_user_variables
473  *  \brief Set the value of a variable of a link at a given timestamp.
474  *
475  *  Same as #TRACE_link_variable_set, but let user specify
476  *  the time used to trace it. Users can specify a time that
477  *  is not the simulated clock time as defined by the core
478  *  simulator. This allows a fine-grain control of time
479  *  definition, but should be used with caution since the trace
480  *  can be inconsistent if resource utilization traces are also traced.
481  *
482  *  \param time The timestamp to be used to tag this change of value.
483  *  \param link The name of the link to be considered.
484  *  \param variable The name of the variable to be considered.
485  *  \param value The new value of the variable.
486  *
487  *  \see TRACE_link_variable_declare, TRACE_link_variable_add_with_time, TRACE_link_variable_sub_with_time
488  */
489 void TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value)
490 {
491   instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SET, NULL);
492 }
493
494 /** \ingroup TRACE_user_variables
495  *  \brief Add a value to a variable of a link at a given timestamp.
496  *
497  *  Same as #TRACE_link_variable_add, but let user specify
498  *  the time used to trace it. Users can specify a time that
499  *  is not the simulated clock time as defined by the core
500  *  simulator. This allows a fine-grain control of time
501  *  definition, but should be used with caution since the trace
502  *  can be inconsistent if resource utilization traces are also traced.
503  *
504  *  \param time The timestamp to be used to tag this change of value.
505  *  \param link The name of the link to be considered.
506  *  \param variable The name of the variable to be considered.
507  *  \param value The value to be added to the variable.
508  *
509  *  \see TRACE_link_variable_declare, TRACE_link_variable_set_with_time, TRACE_link_variable_sub_with_time
510  */
511 void TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value)
512 {
513   instr_user_variable (time, link, variable, "LINK", value, INSTR_US_ADD, NULL);
514 }
515
516 /** \ingroup TRACE_user_variables
517  *  \brief Subtract a value from a variable of a link at a given timestamp.
518  *
519  *  Same as #TRACE_link_variable_sub, but let user specify
520  *  the time used to trace it. Users can specify a time that
521  *  is not the simulated clock time as defined by the core
522  *  simulator. This allows a fine-grain control of time
523  *  definition, but should be used with caution since the trace
524  *  can be inconsistent if resource utilization traces are also traced.
525  *
526  *  \param time The timestamp to be used to tag this change of value.
527  *  \param link The name of the link to be considered.
528  *  \param variable The name of the variable to be considered.
529  *  \param value The value to be subtracted from the variable.
530  *
531  *  \see TRACE_link_variable_declare, TRACE_link_variable_set_with_time, TRACE_link_variable_add_with_time
532  */
533 void TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value)
534 {
535   instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SUB, NULL);
536 }
537
538 /* for link variables, but with src and dst used for get_route */
539 /** \ingroup TRACE_user_variables
540  *  \brief Set the value of the variable present in the links connecting source and destination.
541  *
542  *  Same as #TRACE_link_variable_set, but instead of providing the
543  *  name of link to be considered, provide the source and destination
544  *  hosts. All links that are part of the route between source and
545  *  destination will have the variable set to the provided value.
546  *
547  *  \param src The name of the source host for get route.
548  *  \param dst The name of the destination host for get route.
549  *  \param variable The name of the variable to be considered.
550  *  \param value The new value of the variable.
551  *
552  *  \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_add, TRACE_link_srcdst_variable_sub
553  */
554 void TRACE_link_srcdst_variable_set (const char *src, const char *dst, const char *variable, double value)
555 {
556   TRACE_link_srcdst_variable_set_with_time (MSG_get_clock(), src, dst, variable, value);
557 }
558
559 /** \ingroup TRACE_user_variables
560  *  \brief Add a value to the variable present in the links connecting source and destination.
561  *
562  *  Same as #TRACE_link_variable_add, but instead of providing the
563  *  name of link to be considered, provide the source and destination
564  *  hosts. All links that are part of the route between source and
565  *  destination will have the value passed as parameter added to
566  *  the current value of the variable name to be considered.
567  *
568  *  \param src The name of the source host for get route.
569  *  \param dst The name of the destination host for get route.
570  *  \param variable The name of the variable to be considered.
571  *  \param value The value to be added to the variable.
572  *
573  *  \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set, TRACE_link_srcdst_variable_sub
574  */
575 void TRACE_link_srcdst_variable_add (const char *src, const char *dst, const char *variable, double value)
576 {
577   TRACE_link_srcdst_variable_add_with_time (MSG_get_clock(), src, dst, variable, value);
578 }
579
580 /** \ingroup TRACE_user_variables
581  *  \brief Subtract a value from the variable present in the links connecting source and destination.
582  *
583  *  Same as #TRACE_link_variable_sub, but instead of providing the
584  *  name of link to be considered, provide the source and destination
585  *  hosts. All links that are part of the route between source and
586  *  destination will have the value passed as parameter subtracted from
587  *  the current value of the variable name to be considered.
588  *
589  *  \param src The name of the source host for get route.
590  *  \param dst The name of the destination host for get route.
591  *  \param variable The name of the variable to be considered.
592  *  \param value The value to be subtracted from the variable.
593  *
594  *  \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set, TRACE_link_srcdst_variable_add
595  */
596 void TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const char *variable, double value)
597 {
598   TRACE_link_srcdst_variable_sub_with_time (MSG_get_clock(), src, dst, variable, value);
599 }
600
601 /** \ingroup TRACE_user_variables
602  *  \brief Set the value of the variable present in the links connecting source and destination at a given timestamp.
603  *
604  *  Same as #TRACE_link_srcdst_variable_set, but let user specify
605  *  the time used to trace it. Users can specify a time that
606  *  is not the simulated clock time as defined by the core
607  *  simulator. This allows a fine-grain control of time
608  *  definition, but should be used with caution since the trace
609  *  can be inconsistent if resource utilization traces are also traced.
610  *
611  *  \param time The timestamp to be used to tag this change of value.
612  *  \param src The name of the source host for get route.
613  *  \param dst The name of the destination host for get route.
614  *  \param variable The name of the variable to be considered.
615  *  \param value The new value of the variable.
616  *
617  *  \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_add_with_time, TRACE_link_srcdst_variable_sub_with_time
618  */
619 void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, const char *dst, const char *variable, double value)
620 {
621   instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SET);
622 }
623
624 /** \ingroup TRACE_user_variables
625  *  \brief Add a value to the variable present in the links connecting source and destination at a given timestamp.
626  *
627  *  Same as #TRACE_link_srcdst_variable_add, but let user specify
628  *  the time used to trace it. Users can specify a time that
629  *  is not the simulated clock time as defined by the core
630  *  simulator. This allows a fine-grain control of time
631  *  definition, but should be used with caution since the trace
632  *  can be inconsistent if resource utilization traces are also traced.
633  *
634  *  \param time The timestamp to be used to tag this change of value.
635  *  \param src The name of the source host for get route.
636  *  \param dst The name of the destination host for get route.
637  *  \param variable The name of the variable to be considered.
638  *  \param value The value to be added to the variable.
639  *
640  *  \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set_with_time, TRACE_link_srcdst_variable_sub_with_time
641  */
642 void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, const char *dst, const char *variable, double value)
643 {
644   instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_ADD);
645 }
646
647 /** \ingroup TRACE_user_variables
648  *  \brief Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
649  *
650  *  Same as #TRACE_link_srcdst_variable_sub, but let user specify
651  *  the time used to trace it. Users can specify a time that
652  *  is not the simulated clock time as defined by the core
653  *  simulator. This allows a fine-grain control of time
654  *  definition, but should be used with caution since the trace
655  *  can be inconsistent if resource utilization traces are also traced.
656  *
657  *  \param time The timestamp to be used to tag this change of value.
658  *  \param src The name of the source host for get route.
659  *  \param dst The name of the destination host for get route.
660  *  \param variable The name of the variable to be considered.
661  *  \param value The value to be subtracted from the variable.
662  *
663  *  \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set_with_time, TRACE_link_srcdst_variable_add_with_time
664  */
665 void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, const char *dst, const char *variable, double value)
666 {
667   instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SUB);
668 }
669
670 #endif /* HAVE_TRACING */