1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #include "simgrid_config.h"
10 #include "instr/instr_private.h"
11 #include "surf/network_private.h"
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
22 xbt_dict_t created_categories = NULL;
23 xbt_dict_t declared_marks = NULL;
25 /** \ingroup TRACE_category
26 * \brief Declare a new category with a random color.
28 * This function should be used to define a user category. The
29 * category can be used to differentiate the tasks that are created
30 * during the simulation (for example, tasks from server1, server2,
31 * or request tasks, computation tasks, communication tasks). All
32 * resource utilization (host power and link bandwidth) will be
33 * classified according to the task category. Tasks that do not
34 * belong to a category are not traced. The color for the category
35 * that is being declared is random. This function has no effect
36 * if a category with the same name has been already declared.
38 * See \ref tracing_tracing for details on how to trace
39 * the (categorized) resource utilization.
41 * \param category The name of the new tracing category to be created.
43 * \see TRACE_category_with_color, MSG_task_set_category, SD_task_set_category
45 void TRACE_category(const char *category)
47 TRACE_category_with_color (category, NULL);
50 /** \ingroup TRACE_category
51 * \brief Declare a new category with a color.
53 * Same as #TRACE_category, but let user specify a color encoded as a
54 * RGB-like string with three floats from 0 to 1. So, to specify a
55 * red color, pass "1 0 0" as color parameter. A light-gray color
56 * can be specified using "0.7 0.7 0.7" as color. This function has
57 * no effect if a category with the same name has been already declared.
59 * See \ref tracing_tracing for details on how to trace
60 * the (categorized) resource utilization.
62 * \param category The name of the new tracing category to be created.
63 * \param color The color of the category (see \ref tracing_tracing to
64 * know how to correctly specify the color)
66 * \see MSG_task_set_category, SD_task_set_category
68 void TRACE_category_with_color (const char *category, const char *color)
71 if (!TRACE_is_enabled()) return;
73 if (!(TRACE_categorized() && category != NULL)) return;
75 /* if platform is not traced, we can't deal with categories */
76 if (!TRACE_needs_platform()) return;
78 //check if category is already created
79 char *created = xbt_dict_get_or_null(created_categories, category);
81 xbt_dict_set (created_categories, category, xbt_strdup("1"), NULL);
84 char final_color[INSTR_DEFAULT_STR_SIZE];
86 //generate a random color
87 double red = drand48();
88 double green = drand48();
89 double blue = drand48();
90 snprintf (final_color, INSTR_DEFAULT_STR_SIZE, "%f %f %f", red, green, blue);
92 snprintf (final_color, INSTR_DEFAULT_STR_SIZE, "%s", color);
95 XBT_DEBUG("CAT,declare %s, %s", category, final_color);
97 //define the type of this category on top of hosts and links
98 instr_new_variable_type (category, final_color);
102 /** \ingroup TRACE_category
103 * \brief Get declared categories
105 * This function should be used to get categories that were already
106 * declared with #TRACE_category or with #TRACE_category_with_color.
108 * See \ref tracing_tracing for details on how to trace
109 * the (categorized) resource utilization.
111 * \return A dynar with the declared categories, must be freed with xbt_dynar_free.
113 * \see MSG_task_set_category, SD_task_set_category
115 xbt_dynar_t TRACE_get_categories (void)
117 if (!TRACE_is_enabled()) return NULL;
118 if (!TRACE_categorized()) return NULL;
120 xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
121 xbt_dict_cursor_t cursor = NULL;
123 xbt_dict_foreach(created_categories, cursor, name, value) {
124 xbt_dynar_push_as (ret, char*, xbt_strdup(name));
129 /** \ingroup TRACE_mark
130 * \brief Declare a new type for tracing mark.
132 * This function declares a new Paje event
133 * type in the trace file that can be used by
134 * simulators to declare application-level
135 * marks. This function is independent of
136 * which API is used in SimGrid.
138 * \param mark_type The name of the new type.
142 void TRACE_declare_mark(const char *mark_type)
145 if (!TRACE_is_enabled()) return;
147 if (!mark_type) return;
149 //check if mark_type is already declared
150 char *created = xbt_dict_get_or_null(declared_marks, mark_type);
152 xbt_dict_set (declared_marks, mark_type, xbt_strdup("1"), NULL);
154 XBT_DEBUG("MARK,declare %s", mark_type);
155 PJ_type_event_new(mark_type, NULL, PJ_type_get_root());
159 * \ingroup TRACE_mark
160 * \brief Create a new instance of a tracing mark type.
162 * This function creates a mark in the trace file. The
163 * first parameter had to be previously declared using
164 * #TRACE_declare_mark, the second is the identifier
165 * for this mark instance. We recommend that the
166 * mark_value is a unique value for the whole simulation.
167 * Nevertheless, this is not a strong requirement: the
168 * trace will be valid even if there are multiple mark
169 * identifiers for the same trace.
171 * \param mark_type The name of the type for which the new instance will belong.
172 * \param mark_value The name of the new instance mark.
174 * \see TRACE_declare_mark
176 void TRACE_mark(const char *mark_type, const char *mark_value)
179 if (!TRACE_is_enabled()) return;
181 if (!mark_type || !mark_value) return;
183 //check if mark_type is already declared
184 char *created = xbt_dict_get_or_null(declared_marks, mark_type);
187 XBT_DEBUG("MARK %s %s", mark_type, mark_value);
188 type_t type = PJ_type_get (mark_type, PJ_type_get_root());
190 THROWF (tracing_error, 1, "mark_type with name (%s) not declared before", mark_type);
192 val_t value = PJ_value_get (mark_value, type);
194 value = PJ_value_new (mark_value, NULL, type);
196 new_pajeNewEvent (MSG_get_clock(), PJ_container_get_root(), type, value);
199 /** \ingroup TRACE_mark
200 * \brief Get declared marks
202 * This function should be used to get marks that were already
203 * declared with #TRACE_declare_mark.
205 * \return A dynar with the declared marks, must be freed with xbt_dynar_free.
208 xbt_dynar_t TRACE_get_marks (void)
210 if (!TRACE_is_enabled()) return NULL;
212 xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
213 xbt_dict_cursor_t cursor = NULL;
215 xbt_dict_foreach(declared_marks, cursor, name, value) {
216 xbt_dynar_push_as (ret, char*, xbt_strdup(name));
221 static void instr_user_variable(double time,
222 const char *resource,
223 const char *variable,
224 const char *father_type,
226 InstrUserVariable what,
230 if (!TRACE_is_enabled()) return;
232 /* if platform is not traced, we can't deal user variables */
233 if (!TRACE_needs_platform()) return;
236 snprintf(valuestr, 100, "%g", value);
239 case INSTR_US_DECLARE:
240 instr_new_user_variable_type (father_type, variable, color);
244 container_t container = PJ_container_get(resource);
245 type_t type = PJ_type_get (variable, container->type);
246 new_pajeSetVariable(time, container, type, value);
251 container_t container = PJ_container_get(resource);
252 type_t type = PJ_type_get (variable, container->type);
253 new_pajeAddVariable(time, container, type, value);
258 container_t container = PJ_container_get(resource);
259 type_t type = PJ_type_get (variable, container->type);
260 new_pajeSubVariable(time, container, type, value);
264 //TODO: launch exception
269 static void instr_user_srcdst_variable(double time,
272 const char *variable,
273 const char *father_type,
275 InstrUserVariable what)
277 xbt_dynar_t route=NULL;
278 network_element_t src_elm = xbt_lib_get_or_null(host_lib,src,ROUTING_HOST_LEVEL);
279 if(!src_elm) src_elm = xbt_lib_get_or_null(as_router_lib,src,ROUTING_ASR_LEVEL);
280 if(!src_elm) xbt_die("Element '%s' not found!",src);
282 network_element_t dst_elm = xbt_lib_get_or_null(host_lib,dst,ROUTING_HOST_LEVEL);
283 if(!dst_elm) dst_elm = xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
284 if(!dst_elm) xbt_die("Element '%s' not found!",dst);
286 routing_get_route_and_latency (src_elm, dst_elm, &route,NULL);
289 xbt_dynar_foreach (route, i, link) {
290 char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
291 instr_user_variable (time, link_name, variable, father_type, value, what, NULL);
295 /** \ingroup TRACE_API
296 * \brief Creates a file with the topology of the platform file used for the simulator.
298 * The graph topology will have the following properties: all hosts, links and routers
299 * of the platform file are mapped to graph nodes; routes are mapped to edges.
300 * The platform's AS are not represented in the output.
302 * \param filename The name of the file that will hold the graph.
304 * \return 1 of successful, 0 otherwise.
306 int TRACE_platform_graph_export_graphviz (const char *filename)
308 /* returns 1 if successful, 0 otherwise */
309 if (!TRACE_is_enabled()) return 0;
310 xbt_graph_t g = instr_routing_platform_graph();
311 if (g == NULL) return 0;
312 instr_routing_platform_graph_export_graphviz (g, filename);
313 xbt_graph_free_graph (g, xbt_free, xbt_free, NULL);
318 * Derived functions that use instr_user_variable and TRACE_user_srcdst_variable.
319 * They were previously defined as pre-processors directives, but were transformed
320 * into functions so the user can track them using gdb.
323 /* for host variables */
324 /** \ingroup TRACE_user_variables
325 * \brief Declare a new user variable associated to hosts.
327 * Declare a user variable that will be associated to hosts.
328 * A user host variable can be used to trace user variables
329 * such as the number of tasks in a server, the number of
330 * clients in an application (for hosts), and so on. The color
331 * associated to this new variable will be random.
333 * \param variable The name of the new variable to be declared.
335 * \see TRACE_host_variable_declare_with_color
337 void TRACE_host_variable_declare (const char *variable)
339 instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, NULL);
342 /** \ingroup TRACE_user_variables
343 * \brief Declare a new user variable associated to hosts with a color.
345 * Same as #TRACE_host_variable_declare, but associated a color
346 * to the newly created user host variable. The color needs to be
347 * a string with three numbers separated by spaces in the range [0,1].
348 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
350 * \param variable The name of the new variable to be declared.
351 * \param color The color for the new variable.
354 void TRACE_host_variable_declare_with_color (const char *variable, const char *color)
356 instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, color);
359 /** \ingroup TRACE_user_variables
360 * \brief Set the value of a variable of a host.
362 * \param host The name of the host to be considered.
363 * \param variable The name of the variable to be considered.
364 * \param value The new value of the variable.
366 * \see TRACE_host_variable_declare, TRACE_host_variable_add, TRACE_host_variable_sub
368 void TRACE_host_variable_set (const char *host, const char *variable, double value)
370 TRACE_host_variable_set_with_time (MSG_get_clock(), host, variable, value);
373 /** \ingroup TRACE_user_variables
374 * \brief Add a value to a variable of a host.
376 * \param host The name of the host to be considered.
377 * \param variable The name of the variable to be considered.
378 * \param value The value to be added to the variable.
380 * \see TRACE_host_variable_declare, TRACE_host_variable_set, TRACE_host_variable_sub
382 void TRACE_host_variable_add (const char *host, const char *variable, double value)
384 TRACE_host_variable_add_with_time (MSG_get_clock(), host, variable, value);
387 /** \ingroup TRACE_user_variables
388 * \brief Subtract a value from a variable of a host.
390 * \param host The name of the host to be considered.
391 * \param variable The name of the variable to be considered.
392 * \param value The value to be subtracted from the variable.
394 * \see TRACE_host_variable_declare, TRACE_host_variable_set, TRACE_host_variable_add
396 void TRACE_host_variable_sub (const char *host, const char *variable, double value)
398 TRACE_host_variable_sub_with_time (MSG_get_clock(), host, variable, value);
401 /** \ingroup TRACE_user_variables
402 * \brief Set the value of a variable of a host at a given timestamp.
404 * Same as #TRACE_host_variable_set, but let user specify
405 * the time used to trace it. Users can specify a time that
406 * is not the simulated clock time as defined by the core
407 * simulator. This allows a fine-grain control of time
408 * definition, but should be used with caution since the trace
409 * can be inconsistent if resource utilization traces are also traced.
411 * \param time The timestamp to be used to tag this change of value.
412 * \param host The name of the host to be considered.
413 * \param variable The name of the variable to be considered.
414 * \param value The new value of the variable.
416 * \see TRACE_host_variable_declare, TRACE_host_variable_add_with_time, TRACE_host_variable_sub_with_time
418 void TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value)
420 instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, NULL);
423 /** \ingroup TRACE_user_variables
424 * \brief Add a value to a variable of a host at a given timestamp.
426 * Same as #TRACE_host_variable_add, but let user specify
427 * the time used to trace it. Users can specify a time that
428 * is not the simulated clock time as defined by the core
429 * simulator. This allows a fine-grain control of time
430 * definition, but should be used with caution since the trace
431 * can be inconsistent if resource utilization traces are also traced.
433 * \param time The timestamp to be used to tag this change of value.
434 * \param host The name of the host to be considered.
435 * \param variable The name of the variable to be considered.
436 * \param value The value to be added to the variable.
438 * \see TRACE_host_variable_declare, TRACE_host_variable_set_with_time, TRACE_host_variable_sub_with_time
440 void TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value)
442 instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, NULL);
445 /** \ingroup TRACE_user_variables
446 * \brief Subtract a value from a variable of a host at a given timestamp.
448 * Same as #TRACE_host_variable_sub, but let user specify
449 * the time used to trace it. Users can specify a time that
450 * is not the simulated clock time as defined by the core
451 * simulator. This allows a fine-grain control of time
452 * definition, but should be used with caution since the trace
453 * can be inconsistent if resource utilization traces are also traced.
455 * \param time The timestamp to be used to tag this change of value.
456 * \param host The name of the host to be considered.
457 * \param variable The name of the variable to be considered.
458 * \param value The value to be subtracted from the variable.
460 * \see TRACE_host_variable_declare, TRACE_host_variable_set_with_time, TRACE_host_variable_add_with_time
462 void TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value)
464 instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, NULL);
467 /* for link variables */
468 /** \ingroup TRACE_user_variables
469 * \brief Declare a new user variable associated to links.
471 * Declare a user variable that will be associated to links.
472 * A user link variable can be used, for example, to trace
473 * user variables such as the number of messages being
474 * transferred through network links. The color
475 * associated to this new variable will be random.
477 * \param variable The name of the new variable to be declared.
479 * \see TRACE_link_variable_declare_with_color
481 void TRACE_link_variable_declare (const char *variable)
483 instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, NULL);
486 /** \ingroup TRACE_user_variables
487 * \brief Declare a new user variable associated to links with a color.
489 * Same as #TRACE_link_variable_declare, but associated a color
490 * to the newly created user link variable. The color needs to be
491 * a string with three numbers separated by spaces in the range [0,1].
492 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
494 * \param variable The name of the new variable to be declared.
495 * \param color The color for the new variable.
498 void TRACE_link_variable_declare_with_color (const char *variable, const char *color)
500 instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, color);
503 /** \ingroup TRACE_user_variables
504 * \brief Set the value of a variable of a link.
506 * \param link The name of the link to be considered.
507 * \param variable The name of the variable to be considered.
508 * \param value The new value of the variable.
510 * \see TRACE_link_variable_declare, TRACE_link_variable_add, TRACE_link_variable_sub
512 void TRACE_link_variable_set (const char *link, const char *variable, double value)
514 TRACE_link_variable_set_with_time (MSG_get_clock(), link, variable, value);
517 /** \ingroup TRACE_user_variables
518 * \brief Add a value to a variable of a link.
520 * \param link The name of the link to be considered.
521 * \param variable The name of the variable to be considered.
522 * \param value The value to be added to the variable.
524 * \see TRACE_link_variable_declare, TRACE_link_variable_set, TRACE_link_variable_sub
526 void TRACE_link_variable_add (const char *link, const char *variable, double value)
528 TRACE_link_variable_add_with_time (MSG_get_clock(), link, variable, value);
531 /** \ingroup TRACE_user_variables
532 * \brief Subtract a value from a variable of a link.
534 * \param link The name of the link to be considered.
535 * \param variable The name of the variable to be considered.
536 * \param value The value to be subtracted from the variable.
538 * \see TRACE_link_variable_declare, TRACE_link_variable_set, TRACE_link_variable_add
540 void TRACE_link_variable_sub (const char *link, const char *variable, double value)
542 TRACE_link_variable_sub_with_time (MSG_get_clock(), link, variable, value);
545 /** \ingroup TRACE_user_variables
546 * \brief Set the value of a variable of a link at a given timestamp.
548 * Same as #TRACE_link_variable_set, but let user specify
549 * the time used to trace it. Users can specify a time that
550 * is not the simulated clock time as defined by the core
551 * simulator. This allows a fine-grain control of time
552 * definition, but should be used with caution since the trace
553 * can be inconsistent if resource utilization traces are also traced.
555 * \param time The timestamp to be used to tag this change of value.
556 * \param link The name of the link to be considered.
557 * \param variable The name of the variable to be considered.
558 * \param value The new value of the variable.
560 * \see TRACE_link_variable_declare, TRACE_link_variable_add_with_time, TRACE_link_variable_sub_with_time
562 void TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value)
564 instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SET, NULL);
567 /** \ingroup TRACE_user_variables
568 * \brief Add a value to a variable of a link at a given timestamp.
570 * Same as #TRACE_link_variable_add, but let user specify
571 * the time used to trace it. Users can specify a time that
572 * is not the simulated clock time as defined by the core
573 * simulator. This allows a fine-grain control of time
574 * definition, but should be used with caution since the trace
575 * can be inconsistent if resource utilization traces are also traced.
577 * \param time The timestamp to be used to tag this change of value.
578 * \param link The name of the link to be considered.
579 * \param variable The name of the variable to be considered.
580 * \param value The value to be added to the variable.
582 * \see TRACE_link_variable_declare, TRACE_link_variable_set_with_time, TRACE_link_variable_sub_with_time
584 void TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value)
586 instr_user_variable (time, link, variable, "LINK", value, INSTR_US_ADD, NULL);
589 /** \ingroup TRACE_user_variables
590 * \brief Subtract a value from a variable of a link at a given timestamp.
592 * Same as #TRACE_link_variable_sub, but let user specify
593 * the time used to trace it. Users can specify a time that
594 * is not the simulated clock time as defined by the core
595 * simulator. This allows a fine-grain control of time
596 * definition, but should be used with caution since the trace
597 * can be inconsistent if resource utilization traces are also traced.
599 * \param time The timestamp to be used to tag this change of value.
600 * \param link The name of the link to be considered.
601 * \param variable The name of the variable to be considered.
602 * \param value The value to be subtracted from the variable.
604 * \see TRACE_link_variable_declare, TRACE_link_variable_set_with_time, TRACE_link_variable_add_with_time
606 void TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value)
608 instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SUB, NULL);
611 /* for link variables, but with src and dst used for get_route */
612 /** \ingroup TRACE_user_variables
613 * \brief Set the value of the variable present in the links connecting source and destination.
615 * Same as #TRACE_link_variable_set, but instead of providing the
616 * name of link to be considered, provide the source and destination
617 * hosts. All links that are part of the route between source and
618 * destination will have the variable set to the provided value.
620 * \param src The name of the source host for get route.
621 * \param dst The name of the destination host for get route.
622 * \param variable The name of the variable to be considered.
623 * \param value The new value of the variable.
625 * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_add, TRACE_link_srcdst_variable_sub
627 void TRACE_link_srcdst_variable_set (const char *src, const char *dst, const char *variable, double value)
629 TRACE_link_srcdst_variable_set_with_time (MSG_get_clock(), src, dst, variable, value);
632 /** \ingroup TRACE_user_variables
633 * \brief Add a value to the variable present in the links connecting source and destination.
635 * Same as #TRACE_link_variable_add, but instead of providing the
636 * name of link to be considered, provide the source and destination
637 * hosts. All links that are part of the route between source and
638 * destination will have the value passed as parameter added to
639 * the current value of the variable name to be considered.
641 * \param src The name of the source host for get route.
642 * \param dst The name of the destination host for get route.
643 * \param variable The name of the variable to be considered.
644 * \param value The value to be added to the variable.
646 * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set, TRACE_link_srcdst_variable_sub
648 void TRACE_link_srcdst_variable_add (const char *src, const char *dst, const char *variable, double value)
650 TRACE_link_srcdst_variable_add_with_time (MSG_get_clock(), src, dst, variable, value);
653 /** \ingroup TRACE_user_variables
654 * \brief Subtract a value from the variable present in the links connecting source and destination.
656 * Same as #TRACE_link_variable_sub, but instead of providing the
657 * name of link to be considered, provide the source and destination
658 * hosts. All links that are part of the route between source and
659 * destination will have the value passed as parameter subtracted from
660 * the current value of the variable name to be considered.
662 * \param src The name of the source host for get route.
663 * \param dst The name of the destination host for get route.
664 * \param variable The name of the variable to be considered.
665 * \param value The value to be subtracted from the variable.
667 * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set, TRACE_link_srcdst_variable_add
669 void TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const char *variable, double value)
671 TRACE_link_srcdst_variable_sub_with_time (MSG_get_clock(), src, dst, variable, value);
674 /** \ingroup TRACE_user_variables
675 * \brief Set the value of the variable present in the links connecting source and destination at a given timestamp.
677 * Same as #TRACE_link_srcdst_variable_set, but let user specify
678 * the time used to trace it. Users can specify a time that
679 * is not the simulated clock time as defined by the core
680 * simulator. This allows a fine-grain control of time
681 * definition, but should be used with caution since the trace
682 * can be inconsistent if resource utilization traces are also traced.
684 * \param time The timestamp to be used to tag this change of value.
685 * \param src The name of the source host for get route.
686 * \param dst The name of the destination host for get route.
687 * \param variable The name of the variable to be considered.
688 * \param value The new value of the variable.
690 * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_add_with_time, TRACE_link_srcdst_variable_sub_with_time
692 void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, const char *dst, const char *variable, double value)
694 instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SET);
697 /** \ingroup TRACE_user_variables
698 * \brief Add a value to the variable present in the links connecting source and destination at a given timestamp.
700 * Same as #TRACE_link_srcdst_variable_add, but let user specify
701 * the time used to trace it. Users can specify a time that
702 * is not the simulated clock time as defined by the core
703 * simulator. This allows a fine-grain control of time
704 * definition, but should be used with caution since the trace
705 * can be inconsistent if resource utilization traces are also traced.
707 * \param time The timestamp to be used to tag this change of value.
708 * \param src The name of the source host for get route.
709 * \param dst The name of the destination host for get route.
710 * \param variable The name of the variable to be considered.
711 * \param value The value to be added to the variable.
713 * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set_with_time, TRACE_link_srcdst_variable_sub_with_time
715 void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, const char *dst, const char *variable, double value)
717 instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_ADD);
720 /** \ingroup TRACE_user_variables
721 * \brief Subtract a value from the variable present in the links connecting source and destination at a given timestamp.
723 * Same as #TRACE_link_srcdst_variable_sub, but let user specify
724 * the time used to trace it. Users can specify a time that
725 * is not the simulated clock time as defined by the core
726 * simulator. This allows a fine-grain control of time
727 * definition, but should be used with caution since the trace
728 * can be inconsistent if resource utilization traces are also traced.
730 * \param time The timestamp to be used to tag this change of value.
731 * \param src The name of the source host for get route.
732 * \param dst The name of the destination host for get route.
733 * \param variable The name of the variable to be considered.
734 * \param value The value to be subtracted from the variable.
736 * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set_with_time, TRACE_link_srcdst_variable_add_with_time
738 void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, const char *dst, const char *variable, double value)
740 instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SUB);
743 #endif /* HAVE_TRACING */