Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e94d1983a2f19a0f0e335162352d620f77831f28
[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,
22                                              const char *category);
23 void TRACE_msg_set_process_category(m_process_t process, const char *category, const char *color);
24
25 XBT_PUBLIC(const char *) TRACE_node_name (xbt_node_t node);
26 XBT_PUBLIC(xbt_graph_t) TRACE_platform_graph (void);
27 XBT_PUBLIC(void) TRACE_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
28 XBT_PUBLIC(void) TRACE_declare_mark(const char *mark_type);
29 XBT_PUBLIC(void) TRACE_mark(const char *mark_type, const char *mark_value);
30 XBT_PUBLIC(void) TRACE_smpi_set_category(const char *category);
31 XBT_PUBLIC(void) TRACE_sd_set_task_category(SD_task_t task,
32                                             const char *category);
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
51 #define TRACE_host_variable_declare(var) \
52         TRACE_user_variable(0,NULL,var,"HOST",0,INSTR_US_DECLARE);
53
54 #define TRACE_host_variable_set_with_time(time,host,var,value) \
55         TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SET);
56
57 #define TRACE_host_variable_add_with_time(time,host,var,value) \
58         TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_ADD);
59
60 #define TRACE_host_variable_sub_with_time(time,host,var,value) \
61         TRACE_user_variable(time,host,var,"HOST",value,INSTR_US_SUB);
62
63 #define TRACE_host_variable_set(host,var,value) \
64         TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SET);
65
66 #define TRACE_host_variable_add(host,var,value) \
67         TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_ADD);
68
69 #define TRACE_host_variable_sub(host,var,value) \
70         TRACE_user_variable(MSG_get_clock(),host,var,"HOST",value,INSTR_US_SUB);
71
72 #define TRACE_link_variable_declare(var) \
73         TRACE_user_variable(0,NULL,var,"LINK",0,INSTR_US_DECLARE);
74
75 #define TRACE_link_variable_set_with_time(time,link,var,value) \
76         TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SET);
77
78 #define TRACE_link_variable_add_with_time(time,link,var,value) \
79         TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_ADD);
80
81 #define TRACE_link_variable_sub_with_time(time,link,var,value) \
82         TRACE_user_variable(time,link,var,"LINK",value,INSTR_US_SUB);
83
84 #define TRACE_link_variable_set(link,var,value) \
85         TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SET);
86
87 #define TRACE_link_variable_add(link,var,value) \
88         TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_ADD);
89
90 #define TRACE_link_variable_sub(link,var,value) \
91         TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SUB);
92
93 #else                           /* HAVE_TRACING */
94
95 #define TRACE_category(cat)
96 #define TRACE_category_with_color(cat,color)
97 #define TRACE_msg_set_task_category(task,cat)
98 #define TRACE_msg_set_process_category(proc,cat,color)
99 #define TRACE_set_mask(mask)
100
101 #define TRACE_host_variable_declare(var)
102 #define TRACE_host_variable_set_with_time(time,host,var,value)
103 #define TRACE_host_variable_add_with_time(time,host,var,value)
104 #define TRACE_host_variable_sub_with_time(time,host,var,value)
105 #define TRACE_host_variable_set(host,var,value)
106 #define TRACE_host_variable_add(host,var,value)
107 #define TRACE_host_variable_sub(host,var,value)
108 #define TRACE_link_variable_declare(var)
109 #define TRACE_link_variable_set_with_time(time,link,var,value)
110 #define TRACE_link_variable_add_with_time(time,link,var,value)
111 #define TRACE_link_variable_sub_with_time(time,link,var,value)
112 #define TRACE_link_variable_set(link,var,value)
113 #define TRACE_link_variable_add(link,var,value)
114 #define TRACE_link_variable_sub(link,var,value)
115 #define TRACE_declare_mark(type)
116 #define TRACE_mark(type,value)
117 #define TRACE_smpi_set_category(cat)
118 #define TRACE_sd_set_task_category(task,cat)
119
120 #endif                          /* HAVE_TRACING */
121
122 #endif                          /* INSTR_H_ */