Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4449bdd6f000cf9f6e8b7914c70c6d1656d6e735
[simgrid.git] / include / instr / instr.h
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 #ifndef INSTR_H_
8 #define INSTR_H_
9
10 #include "simgrid_config.h"
11
12 #ifdef HAVE_TRACING
13
14 #include "xbt.h"
15 #include "xbt/graph.h"
16 #include "msg/msg.h"
17 #include "simdag/simdag.h"
18
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);
25
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);
28
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);
32
33
34 /*
35  * User-variables related functions
36  */
37 typedef enum {
38   INSTR_US_DECLARE,
39   INSTR_US_SET,
40   INSTR_US_ADD,
41   INSTR_US_SUB,
42 } InstrUserVariable;
43
44 XBT_PUBLIC(void) TRACE_user_variable(double time,
45                               const char *resource,
46                               const char *variable,
47                               const char *father_type,
48                               double value,
49                               InstrUserVariable what);
50 XBT_PUBLIC(void) TRACE_user_srcdst_variable(double time,
51                               const char *src,
52                               const char *dst,
53                               const char *variable,
54                               const char *father_type,
55                               double value,
56                               InstrUserVariable what);
57
58 #define TRACE_host_variable_declare(var) \
59         TRACE_user_variable(0,NULL,var,"HOST",0,INSTR_US_DECLARE);
60
61 #define TRACE_host_variable_set_with_time(time,host,var,value) \
62         TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SET);
63
64 #define TRACE_host_variable_add_with_time(time,host,var,value) \
65         TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_ADD);
66
67 #define TRACE_host_variable_sub_with_time(time,host,var,value) \
68         TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SUB);
69
70 #define TRACE_host_variable_set(host,var,value) \
71         TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SET);
72
73 #define TRACE_host_variable_add(host,var,value) \
74         TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_ADD);
75
76 #define TRACE_host_variable_sub(host,var,value) \
77         TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SUB);
78
79 #define TRACE_link_variable_declare(var) \
80         TRACE_user_variable(0,NULL,var,"LINK",0,INSTR_US_DECLARE);
81
82 #define TRACE_link_variable_set_with_time(time,link,var,value) \
83         TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SET);
84
85 #define TRACE_link_variable_add_with_time(time,link,var,value) \
86         TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_ADD);
87
88 #define TRACE_link_variable_sub_with_time(time,link,var,value) \
89         TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SUB);
90
91 #define TRACE_link_variable_set(link,var,value) \
92         TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SET);
93
94 #define TRACE_link_variable_add(link,var,value) \
95         TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_ADD);
96
97 #define TRACE_link_variable_sub(link,var,value) \
98         TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SUB);
99
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);
104
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);
107
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);
110
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);
113
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);
116
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);
119
120 #else                           /* HAVE_TRACING */
121
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)
133
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)
154
155
156
157 #endif                          /* HAVE_TRACING */
158
159 #endif                          /* INSTR_H_ */