Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] cosmetics, cleaner public include tracing header
[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
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(category)
96 #define TRACE_category_with_color(category,color)
97 #define TRACE_msg_set_task_category(task,category)
98 #define TRACE_msg_set_process_category(process,category,color)
99 #define TRACE_smpi_set_category(category)
100 #define TRACE_sd_set_task_category(task,category)
101 #define TRACE_declare_mark(mark_type)
102 #define TRACE_mark(mark_type,mark_value)
103 #define TRACE_node_name(node)
104 #define TRACE_platform_graph(void)
105 #define TRACE_platform_graph_export_graphviz(g,filename)
106
107 #define TRACE_host_variable_declare(var)
108 #define TRACE_host_variable_set_with_time(time,host,var,value)
109 #define TRACE_host_variable_add_with_time(time,host,var,value)
110 #define TRACE_host_variable_sub_with_time(time,host,var,value)
111 #define TRACE_host_variable_set(host,var,value)
112 #define TRACE_host_variable_add(host,var,value)
113 #define TRACE_host_variable_sub(host,var,value)
114 #define TRACE_link_variable_declare(var)
115 #define TRACE_link_variable_set_with_time(time,link,var,value)
116 #define TRACE_link_variable_add_with_time(time,link,var,value)
117 #define TRACE_link_variable_sub_with_time(time,link,var,value)
118 #define TRACE_link_variable_set(link,var,value)
119 #define TRACE_link_variable_add(link,var,value)
120 #define TRACE_link_variable_sub(link,var,value)
121
122 #endif                          /* HAVE_TRACING */
123
124 #endif                          /* INSTR_H_ */