X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5391e6b0fad0842c9c69f13d14a4fb4527268848..c5f13796049934534009468a92c64392d0092510:/include/instr/instr.h diff --git a/include/instr/instr.h b/include/instr/instr.h index 74deeed5e0..4449bdd6f0 100644 --- a/include/instr/instr.h +++ b/include/instr/instr.h @@ -7,106 +7,153 @@ #ifndef INSTR_H_ #define INSTR_H_ +#include "simgrid_config.h" + #ifdef HAVE_TRACING #include "xbt.h" +#include "xbt/graph.h" #include "msg/msg.h" - -/* Trace error codes (used in exceptions) */ -#define TRACE_ERROR_COMPLEX_ROUTES 100 -#define TRACE_ERROR_TYPE_NOT_DEFINED 200 -#define TRACE_ERROR_TYPE_ALREADY_DEFINED 201 -#define TRACE_ERROR_CATEGORY_NOT_DEFINED 300 -#define TRACE_ERROR_CATEGORY_ALREADY_DEFINED 301 -#define TRACE_ERROR_MASK 400 -#define TRACE_ERROR_FILE_OPEN 401 -#define TRACE_ERROR_START 500 - -XBT_PUBLIC(int) TRACE_start (void); -XBT_PUBLIC(int) TRACE_end (void); -XBT_PUBLIC(int) TRACE_category (const char *category); -XBT_PUBLIC(void) TRACE_define_type (const char *type, const char *parent_type, int final); -XBT_PUBLIC(int) TRACE_create_category (const char *category, const char *type, const char *parent_category); -XBT_PUBLIC(void) TRACE_msg_set_task_category (m_task_t task, const char *category); -XBT_PUBLIC(void) TRACE_msg_set_process_category (m_process_t process, const char *category); -XBT_PUBLIC(void) TRACE_set_mask (int mask); -XBT_PUBLIC(void) __TRACE_host_variable (double time, const char *variable, double value, const char *what); -XBT_PUBLIC(void) __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what); -XBT_PUBLIC(void) TRACE_declare_mark (const char *mark_type); -XBT_PUBLIC(void) TRACE_mark (const char *mark_type, const char *mark_value); -XBT_PUBLIC(int) TRACE_smpi_set_category (const char *category); +#include "simdag/simdag.h" + +XBT_PUBLIC(void) TRACE_category(const char *category); +XBT_PUBLIC(void) TRACE_category_with_color (const char *category, const char *color); +XBT_PUBLIC(void) TRACE_msg_set_task_category(m_task_t task, const char *category); +XBT_PUBLIC(void) TRACE_msg_set_process_category(m_process_t process, const char *category, const char *color); +XBT_PUBLIC(void) TRACE_smpi_set_category(const char *category); +XBT_PUBLIC(void) TRACE_sd_set_task_category(SD_task_t task, const char *category); + +XBT_PUBLIC(void) TRACE_declare_mark(const char *mark_type); +XBT_PUBLIC(void) TRACE_mark(const char *mark_type, const char *mark_value); + +XBT_PUBLIC(const char *) TRACE_node_name (xbt_node_t node); +XBT_PUBLIC(xbt_graph_t) TRACE_platform_graph (void); +XBT_PUBLIC(void) TRACE_platform_graph_export_graphviz (xbt_graph_t g, const char *filename); + + +/* + * User-variables related functions + */ +typedef enum { + INSTR_US_DECLARE, + INSTR_US_SET, + INSTR_US_ADD, + INSTR_US_SUB, +} InstrUserVariable; + +XBT_PUBLIC(void) TRACE_user_variable(double time, + const char *resource, + const char *variable, + const char *father_type, + double value, + InstrUserVariable what); +XBT_PUBLIC(void) TRACE_user_srcdst_variable(double time, + const char *src, + const char *dst, + const char *variable, + const char *father_type, + double value, + InstrUserVariable what); #define TRACE_host_variable_declare(var) \ - __TRACE_host_variable(0,var,0,"declare"); + TRACE_user_variable(0,NULL,var,"HOST",0,INSTR_US_DECLARE); -#define TRACE_host_variable_set_with_time(time,var,value) \ - __TRACE_host_variable(time,var,value,"set"); +#define TRACE_host_variable_set_with_time(time,host,var,value) \ + TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SET); -#define TRACE_host_variable_add_with_time(time,var,value) \ - __TRACE_host_variable(time,var,value,"add"); +#define TRACE_host_variable_add_with_time(time,host,var,value) \ + TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_ADD); -#define TRACE_host_variable_sub_with_time(time,var,value) \ - __TRACE_host_variable(time,var,value,"sub"); +#define TRACE_host_variable_sub_with_time(time,host,var,value) \ + TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SUB); -#define TRACE_host_variable_set(var,value) \ - __TRACE_host_variable(MSG_get_clock(),var,value,"set"); +#define TRACE_host_variable_set(host,var,value) \ + TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SET); -#define TRACE_host_variable_add(var,value) \ - __TRACE_host_variable(MSG_get_clock(),var,value,"add"); +#define TRACE_host_variable_add(host,var,value) \ + TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_ADD); -#define TRACE_host_variable_sub(var,value) \ - __TRACE_host_variable(MSG_get_clock(),var,value,"sub"); +#define TRACE_host_variable_sub(host,var,value) \ + TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SUB); #define TRACE_link_variable_declare(var) \ - __TRACE_link_variable(0,NULL,NULL,var,0,"declare"); + TRACE_user_variable(0,NULL,var,"LINK",0,INSTR_US_DECLARE); + +#define TRACE_link_variable_set_with_time(time,link,var,value) \ + TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SET); + +#define TRACE_link_variable_add_with_time(time,link,var,value) \ + TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_ADD); + +#define TRACE_link_variable_sub_with_time(time,link,var,value) \ + TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SUB); + +#define TRACE_link_variable_set(link,var,value) \ + TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SET); -#define TRACE_link_variable_set_with_time(time,src,dst,var,value) \ - __TRACE_link_variable(time,src,dst,var,value,"set"); +#define TRACE_link_variable_add(link,var,value) \ + TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_ADD); -#define TRACE_link_variable_add_with_time(time,src,dst,var,value) \ - __TRACE_link_variable(time,src,dst,var,value,"add"); +#define TRACE_link_variable_sub(link,var,value) \ + TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SUB); -#define TRACE_link_variable_sub_with_time(time,src,dst,var,value) \ - __TRACE_link_variable(time,src,dst,var,value,"sub"); +//user provides src and dst, we set the value for the variables of all +//links connecting src and dst +#define TRACE_link_srcdst_variable_set_with_time(time,src,dst,var,value) \ + TRACE_user_srcdst_variable(time,src,dst,,var,"LINK",value,INSTR_US_SET); -#define TRACE_link_variable_set(src,dst,var,value) \ - __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"set"); +#define TRACE_link_srcdst_variable_add_with_time(time,src,dst,var,value) \ + TRACE_user_srcdst_variable(time,src,dst,var,"LINK",value,INSTR_US_ADD); -#define TRACE_link_variable_add(src,dst,var,value) \ - __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"add"); +#define TRACE_link_srcdst_variable_sub_with_time(time,src,dst,var,value) \ + TRACE_user_srcdst_variable(time,src,dst,var,"LINK",value,INSTR_US_SUB); -#define TRACE_link_variable_sub(src,dst,var,value) \ - __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"sub"); +#define TRACE_link_srcdst_variable_set(src,dst,var,value) \ + TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_SET); -#else /* HAVE_TRACING */ +#define TRACE_link_srcdst_variable_add(src,dst,var,value) \ + TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_ADD); -#define TRACE_start() -#define TRACE_end() -#define TRACE_category(cat) -#define TRACE_define_type(cat,supercat,final) -#define TRACE_create_category(inst,cat) -#define TRACE_msg_set_task_category(task,cat) -#define TRACE_msg_set_process_category(proc,cat) -#define TRACE_set_mask(mask) +#define TRACE_link_srcdst_variable_sub(src,dst,var,value) \ + TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_SUB); + +#else /* HAVE_TRACING */ + +#define TRACE_category(category) +#define TRACE_category_with_color(category,color) +#define TRACE_msg_set_task_category(task,category) +#define TRACE_msg_set_process_category(process,category,color) +#define TRACE_smpi_set_category(category) +#define TRACE_sd_set_task_category(task,category) +#define TRACE_declare_mark(mark_type) +#define TRACE_mark(mark_type,mark_value) +#define TRACE_node_name(node) +#define TRACE_platform_graph(void) +#define TRACE_platform_graph_export_graphviz(g,filename) #define TRACE_host_variable_declare(var) -#define TRACE_host_variable_set_with_time(time,var,value) -#define TRACE_host_variable_add_with_time(time,var,value) -#define TRACE_host_variable_sub_with_time(time,var,value) -#define TRACE_host_variable_set(var,value) -#define TRACE_host_variable_add(var,value) -#define TRACE_host_variable_sub(var,value) +#define TRACE_host_variable_set_with_time(time,host,var,value) +#define TRACE_host_variable_add_with_time(time,host,var,value) +#define TRACE_host_variable_sub_with_time(time,host,var,value) +#define TRACE_host_variable_set(host,var,value) +#define TRACE_host_variable_add(host,var,value) +#define TRACE_host_variable_sub(host,var,value) #define TRACE_link_variable_declare(var) -#define TRACE_link_variable_set_with_time(time,src,dst,var,value) -#define TRACE_link_variable_add_with_time(time,src,dst,var,value) -#define TRACE_link_variable_sub_with_time(time,src,dst,var,value) -#define TRACE_link_variable_set(src,dst,var,value) -#define TRACE_link_variable_add(src,dst,var,value) -#define TRACE_link_variable_sub(src,dst,var,value) -#define TRACE_declare_mark(type) -#define TRACE_mark(type,value) -#define TRACE_smpi_set_category(cat) - -#endif /* HAVE_TRACING */ - -#endif /* INSTR_H_ */ +#define TRACE_link_variable_set_with_time(time,link,var,value) +#define TRACE_link_variable_add_with_time(time,link,var,value) +#define TRACE_link_variable_sub_with_time(time,link,var,value) +#define TRACE_link_variable_set(link,var,value) +#define TRACE_link_variable_add(link,var,value) +#define TRACE_link_variable_sub(link,var,value) +#define TRACE_link_srcdst_variable_set_with_time(time,src,dst,var,value) +#define TRACE_link_srcdst_variable_add_with_time(time,src,dst,var,value) +#define TRACE_link_srcdst_variable_sub_with_time(time,src,dst,var,value) +#define TRACE_link_srcdst_variable_set(src,dst,var,value) +#define TRACE_link_srcdst_variable_add(src,dst,var,value) +#define TRACE_link_srcdst_variable_sub(src,dst,var,value) + + + +#endif /* HAVE_TRACING */ + +#endif /* INSTR_H_ */