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. */
10 #include "simgrid_config.h"
15 #include "xbt/graph.h"
17 #include "simdag/simdag.h"
19 XBT_PUBLIC(void) TRACE_category(const char *category);
20 XBT_PUBLIC(void) TRACE_category_with_color (const char *category, const char *color);
21 XBT_PUBLIC(void) TRACE_msg_set_task_category(m_task_t task, const char *category);
22 XBT_PUBLIC(void) TRACE_msg_set_process_category(m_process_t process, const char *category, const char *color);
23 XBT_PUBLIC(void) TRACE_smpi_set_category(const char *category);
24 XBT_PUBLIC(void) TRACE_sd_set_task_category(SD_task_t task, const char *category);
26 XBT_PUBLIC(void) TRACE_declare_mark(const char *mark_type);
27 XBT_PUBLIC(void) TRACE_mark(const char *mark_type, const char *mark_value);
29 XBT_PUBLIC(const char *) TRACE_node_name (xbt_node_t node);
30 XBT_PUBLIC(xbt_graph_t) TRACE_platform_graph (void);
31 XBT_PUBLIC(void) TRACE_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
35 * User-variables related functions
44 XBT_PUBLIC(void) TRACE_user_variable(double time,
47 const char *father_type,
49 InstrUserVariable what);
50 XBT_PUBLIC(void) TRACE_user_srcdst_variable(double time,
54 const char *father_type,
56 InstrUserVariable what);
58 #define TRACE_host_variable_declare(var) \
59 TRACE_user_variable(0,NULL,var,"HOST",0,INSTR_US_DECLARE);
61 #define TRACE_host_variable_set_with_time(time,host,var,value) \
62 TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SET);
64 #define TRACE_host_variable_add_with_time(time,host,var,value) \
65 TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_ADD);
67 #define TRACE_host_variable_sub_with_time(time,host,var,value) \
68 TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SUB);
70 #define TRACE_host_variable_set(host,var,value) \
71 TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SET);
73 #define TRACE_host_variable_add(host,var,value) \
74 TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_ADD);
76 #define TRACE_host_variable_sub(host,var,value) \
77 TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SUB);
79 #define TRACE_link_variable_declare(var) \
80 TRACE_user_variable(0,NULL,var,"LINK",0,INSTR_US_DECLARE);
82 #define TRACE_link_variable_set_with_time(time,link,var,value) \
83 TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SET);
85 #define TRACE_link_variable_add_with_time(time,link,var,value) \
86 TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_ADD);
88 #define TRACE_link_variable_sub_with_time(time,link,var,value) \
89 TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SUB);
91 #define TRACE_link_variable_set(link,var,value) \
92 TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SET);
94 #define TRACE_link_variable_add(link,var,value) \
95 TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_ADD);
97 #define TRACE_link_variable_sub(link,var,value) \
98 TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SUB);
100 //user provides src and dst, we set the value for the variables of all
101 //links connecting src and dst
102 #define TRACE_link_srcdst_variable_set_with_time(time,src,dst,var,value) \
103 TRACE_user_srcdst_variable(time,src,dst,,var,"LINK",value,INSTR_US_SET);
105 #define TRACE_link_srcdst_variable_add_with_time(time,src,dst,var,value) \
106 TRACE_user_srcdst_variable(time,src,dst,var,"LINK",value,INSTR_US_ADD);
108 #define TRACE_link_srcdst_variable_sub_with_time(time,src,dst,var,value) \
109 TRACE_user_srcdst_variable(time,src,dst,var,"LINK",value,INSTR_US_SUB);
111 #define TRACE_link_srcdst_variable_set(src,dst,var,value) \
112 TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_SET);
114 #define TRACE_link_srcdst_variable_add(src,dst,var,value) \
115 TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_ADD);
117 #define TRACE_link_srcdst_variable_sub(src,dst,var,value) \
118 TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_SUB);
120 #else /* HAVE_TRACING */
122 #define TRACE_category(category)
123 #define TRACE_category_with_color(category,color)
124 #define TRACE_msg_set_task_category(task,category)
125 #define TRACE_msg_set_process_category(process,category,color)
126 #define TRACE_smpi_set_category(category)
127 #define TRACE_sd_set_task_category(task,category)
128 #define TRACE_declare_mark(mark_type)
129 #define TRACE_mark(mark_type,mark_value)
130 #define TRACE_node_name(node)
131 #define TRACE_platform_graph(void)
132 #define TRACE_platform_graph_export_graphviz(g,filename)
134 #define TRACE_host_variable_declare(var)
135 #define TRACE_host_variable_set_with_time(time,host,var,value)
136 #define TRACE_host_variable_add_with_time(time,host,var,value)
137 #define TRACE_host_variable_sub_with_time(time,host,var,value)
138 #define TRACE_host_variable_set(host,var,value)
139 #define TRACE_host_variable_add(host,var,value)
140 #define TRACE_host_variable_sub(host,var,value)
141 #define TRACE_link_variable_declare(var)
142 #define TRACE_link_variable_set_with_time(time,link,var,value)
143 #define TRACE_link_variable_add_with_time(time,link,var,value)
144 #define TRACE_link_variable_sub_with_time(time,link,var,value)
145 #define TRACE_link_variable_set(link,var,value)
146 #define TRACE_link_variable_add(link,var,value)
147 #define TRACE_link_variable_sub(link,var,value)
148 #define TRACE_link_srcdst_variable_set_with_time(time,src,dst,var,value)
149 #define TRACE_link_srcdst_variable_add_with_time(time,src,dst,var,value)
150 #define TRACE_link_srcdst_variable_sub_with_time(time,src,dst,var,value)
151 #define TRACE_link_srcdst_variable_set(src,dst,var,value)
152 #define TRACE_link_srcdst_variable_add(src,dst,var,value)
153 #define TRACE_link_srcdst_variable_sub(src,dst,var,value)
157 #endif /* HAVE_TRACING */
159 #endif /* INSTR_H_ */