Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] logging the categorized/uncategorized resource utilization tracing mechanism
[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 "msg/msg.h"
16 #include "simdag/simdag.h"
17
18 /* Trace error codes (used in exceptions) */
19 #define TRACE_ERROR_COMPLEX_ROUTES 100
20 #define TRACE_ERROR_TYPE_NOT_DEFINED 200
21 #define TRACE_ERROR_TYPE_ALREADY_DEFINED 201
22 #define TRACE_ERROR_CATEGORY_NOT_DEFINED 300
23 #define TRACE_ERROR_CATEGORY_ALREADY_DEFINED 301
24 #define TRACE_ERROR_MASK 400
25 #define TRACE_ERROR_FILE_OPEN 401
26 #define TRACE_ERROR_START 500
27 #define TRACE_ERROR_ALREADY_ACTIVE 501
28
29 XBT_PUBLIC(int) TRACE_start(void);
30 XBT_PUBLIC(int) TRACE_end(void);
31 XBT_PUBLIC(int) TRACE_category(const char *category);
32 XBT_PUBLIC(int) TRACE_category_with_color (const char *category, const char *color);
33 XBT_PUBLIC(void) TRACE_define_type(const char *type,
34                                    const char *parent_type, int final);
35 XBT_PUBLIC(int) TRACE_create_category(const char *category,
36                                       const char *type,
37                                       const char *parent_category);
38 XBT_PUBLIC(int) TRACE_create_category_with_color(const char *category,
39                           const char *type,
40                           const char *parent_category,
41                           const char *color);
42 XBT_PUBLIC(void) TRACE_msg_set_task_category(m_task_t task,
43                                              const char *category);
44 XBT_PUBLIC(void) TRACE_msg_set_process_category(m_process_t process,
45                                                 const char *category);
46 XBT_PUBLIC(void) TRACE_set_mask(int mask);
47 XBT_PUBLIC(void) TRACE_user_host_variable(double time,
48                                           const char *variable,
49                                           double value, const char *what);
50 XBT_PUBLIC(void) TRACE_user_link_variable(double time, const char *src,
51                                           const char *dst,
52                                           const char *variable,
53                                           double value, const char *what);
54 XBT_PUBLIC(void) TRACE_declare_mark(const char *mark_type);
55 XBT_PUBLIC(void) TRACE_mark(const char *mark_type, const char *mark_value);
56 XBT_PUBLIC(int) TRACE_smpi_set_category(const char *category);
57 XBT_PUBLIC(void) TRACE_sd_set_task_category(SD_task_t task,
58                                             const char *category);
59
60 #define TRACE_host_variable_declare(var) \
61         TRACE_user_host_variable(0,var,0,"declare");
62
63 #define TRACE_host_variable_set_with_time(time,var,value) \
64         TRACE_user_host_variable(time,var,value,"set");
65
66 #define TRACE_host_variable_add_with_time(time,var,value) \
67         TRACE_user_host_variable(time,var,value,"add");
68
69 #define TRACE_host_variable_sub_with_time(time,var,value) \
70         TRACE_user_host_variable(time,var,value,"sub");
71
72 #define TRACE_host_variable_set(var,value) \
73         TRACE_user_host_variable(MSG_get_clock(),var,value,"set");
74
75 #define TRACE_host_variable_add(var,value) \
76         TRACE_user_host_variable(MSG_get_clock(),var,value,"add");
77
78 #define TRACE_host_variable_sub(var,value) \
79         TRACE_user_host_variable(MSG_get_clock(),var,value,"sub");
80
81 #define TRACE_link_variable_declare(var) \
82         TRACE_user_link_variable(0,NULL,NULL,var,0,"declare");
83
84 #define TRACE_link_variable_set_with_time(time,src,dst,var,value) \
85         TRACE_user_link_variable(time,src,dst,var,value,"set");
86
87 #define TRACE_link_variable_add_with_time(time,src,dst,var,value) \
88         TRACE_user_link_variable(time,src,dst,var,value,"add");
89
90 #define TRACE_link_variable_sub_with_time(time,src,dst,var,value) \
91         TRACE_user_link_variable(time,src,dst,var,value,"sub");
92
93 #define TRACE_link_variable_set(src,dst,var,value) \
94         TRACE_user_link_variable(MSG_get_clock(),src,dst,var,value,"set");
95
96 #define TRACE_link_variable_add(src,dst,var,value) \
97         TRACE_user_link_variable(MSG_get_clock(),src,dst,var,value,"add");
98
99 #define TRACE_link_variable_sub(src,dst,var,value) \
100         TRACE_user_link_variable(MSG_get_clock(),src,dst,var,value,"sub");
101
102 #else                           /* HAVE_TRACING */
103
104 #define TRACE_start()
105 #define TRACE_end()
106 #define TRACE_category(cat)
107 #define TRACE_define_type(cat,supercat,final)
108 #define TRACE_create_category(inst,cat)
109 #define TRACE_msg_set_task_category(task,cat)
110 #define TRACE_msg_set_process_category(proc,cat)
111 #define TRACE_set_mask(mask)
112
113 #define TRACE_host_variable_declare(var)
114 #define TRACE_host_variable_set_with_time(time,var,value)
115 #define TRACE_host_variable_add_with_time(time,var,value)
116 #define TRACE_host_variable_sub_with_time(time,var,value)
117 #define TRACE_host_variable_set(var,value)
118 #define TRACE_host_variable_add(var,value)
119 #define TRACE_host_variable_sub(var,value)
120 #define TRACE_link_variable_declare(var)
121 #define TRACE_link_variable_set_with_time(time,src,dst,var,value)
122 #define TRACE_link_variable_add_with_time(time,src,dst,var,value)
123 #define TRACE_link_variable_sub_with_time(time,src,dst,var,value)
124 #define TRACE_link_variable_set(src,dst,var,value)
125 #define TRACE_link_variable_add(src,dst,var,value)
126 #define TRACE_link_variable_sub(src,dst,var,value)
127 #define TRACE_declare_mark(type)
128 #define TRACE_mark(type,value)
129 #define TRACE_smpi_set_category(cat)
130 #define TRACE_sd_set_task_category(task,cat)
131
132 #endif                          /* HAVE_TRACING */
133
134 #endif                          /* INSTR_H_ */