1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
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. */
13 #define TRACE_PLATFORM 1
14 #define TRACE_PROCESS 2
16 #define TRACE_VOLUME 8
21 /* Trace error codes (used in exceptions) */
22 #define TRACE_ERROR_COMPLEX_ROUTES 100
23 #define TRACE_ERROR_TYPE_NOT_DEFINED 200
24 #define TRACE_ERROR_TYPE_ALREADY_DEFINED 201
25 #define TRACE_ERROR_CATEGORY_NOT_DEFINED 300
26 #define TRACE_ERROR_CATEGORY_ALREADY_DEFINED 301
27 #define TRACE_ERROR_MASK 400
28 #define TRACE_ERROR_FILE_OPEN 401
29 #define TRACE_ERROR_START 500
31 XBT_PUBLIC(int) TRACE_start_with_mask (const char *filename, int mask);
32 XBT_PUBLIC(int) TRACE_start (const char *filename);
33 XBT_PUBLIC(int) TRACE_end (void);
34 XBT_PUBLIC(int) TRACE_category (const char *category);
35 XBT_PUBLIC(void) TRACE_define_type (const char *type, const char *parent_type, int final);
36 XBT_PUBLIC(int) TRACE_create_category (const char *category, const char *type, const char *parent_category);
37 XBT_PUBLIC(void) TRACE_msg_set_task_category (m_task_t task, const char *category);
38 XBT_PUBLIC(void) TRACE_msg_set_process_category (m_process_t process, const char *category);
39 XBT_PUBLIC(void) TRACE_set_mask (int mask);
40 XBT_PUBLIC(void) __TRACE_host_variable (double time, const char *variable, double value, const char *what);
41 XBT_PUBLIC(void) __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what);
43 #define TRACE_host_variable_declare(var) \
44 __TRACE_host_variable(0,var,0,"declare");
46 #define TRACE_host_variable_set_with_time(time,var,value) \
47 __TRACE_host_variable(time,var,value,"set");
49 #define TRACE_host_variable_add_with_time(time,var,value) \
50 __TRACE_host_variable(time,var,value,"add");
52 #define TRACE_host_variable_sub_with_time(time,var,value) \
53 __TRACE_host_variable(time,var,value,"sub");
55 #define TRACE_host_variable_set(var,value) \
56 __TRACE_host_variable(MSG_get_clock(),var,value,"set");
58 #define TRACE_host_variable_add(var,value) \
59 __TRACE_host_variable(MSG_get_clock(),var,value,"add");
61 #define TRACE_host_variable_sub(var,value) \
62 __TRACE_host_variable(MSG_get_clock(),var,value,"sub");
64 #define TRACE_link_variable_declare(var) \
65 __TRACE_link_variable(0,NULL,NULL,var,0,"declare");
67 #define TRACE_link_variable_set_with_time(time,src,dst,var,value) \
68 __TRACE_link_variable(time,src,dst,var,value,"set");
70 #define TRACE_link_variable_add_with_time(time,src,dst,var,value) \
71 __TRACE_link_variable(time,src,dst,var,value,"add");
73 #define TRACE_link_variable_sub_with_time(time,src,dst,var,value) \
74 __TRACE_link_variable(time,src,dst,var,value,"sub");
76 #define TRACE_link_variable_set(src,dst,var,value) \
77 __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"set");
79 #define TRACE_link_variable_add(src,dst,var,value) \
80 __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"add");
82 #define TRACE_link_variable_sub(src,dst,var,value) \
83 __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"sub");
85 #else /* HAVE_TRACING */
87 #define TRACE_start(filename)
88 #define TRACE_start_with_mask(filename,mask)
90 #define TRACE_category(cat)
91 #define TRACE_define_type(cat,supercat,final)
92 #define TRACE_create_category(inst,cat)
93 #define TRACE_msg_set_task_category(task,cat)
94 #define TRACE_msg_set_process_category(proc,cat)
95 #define TRACE_set_mask(mask)
97 #define TRACE_host_variable_declare(var)
98 #define TRACE_host_variable_set_with_time(time,var,value)
99 #define TRACE_host_variable_add_with_time(time,var,value)
100 #define TRACE_host_variable_sub_with_time(time,var,value)
101 #define TRACE_host_variable_set(var,value)
102 #define TRACE_host_variable_add(var,value)
103 #define TRACE_host_variable_sub(var,value)
104 #define TRACE_link_variable_declare(var)
105 #define TRACE_link_variable_set_with_time(time,src,dst,var,value)
106 #define TRACE_link_variable_add_with_time(time,src,dst,var,value)
107 #define TRACE_link_variable_sub_with_time(time,src,dst,var,value)
108 #define TRACE_link_variable_set(src,dst,var,value)
109 #define TRACE_link_variable_add(src,dst,var,value)
110 #define TRACE_link_variable_sub(src,dst,var,value)
112 #endif /* HAVE_TRACING */
114 #endif /* INSTR_H_ */