4 * Created on: Nov 23, 2009
5 * Author: Lucas Schnorr
6 * License: This program is free software; you can redistribute
7 * it and/or modify it under the terms of the license
8 * (GNU LGPL) which comes with this package.
10 * Copyright (c) 2009 The SimGrid team.
16 #include "instr/tracing_config.h"
21 #define TRACE_PLATFORM 1
22 #define TRACE_PROCESS 2
28 /* Trace error codes (used in exceptions) */
29 #define TRACE_ERROR_COMPLEX_ROUTES 100
30 #define TRACE_ERROR_TYPE_NOT_DEFINED 200
31 #define TRACE_ERROR_TYPE_ALREADY_DEFINED 201
32 #define TRACE_ERROR_CATEGORY_NOT_DEFINED 300
33 #define TRACE_ERROR_CATEGORY_ALREADY_DEFINED 301
34 #define TRACE_ERROR_MASK 400
35 #define TRACE_ERROR_FILE_OPEN 401
37 XBT_PUBLIC(int) TRACE_start_with_mask (const char *filename, int mask);
38 XBT_PUBLIC(int) TRACE_end (void);
39 XBT_PUBLIC(void) TRACE_category (const char *category);
40 XBT_PUBLIC(void) TRACE_define_type (const char *type, const char *parent_type, int final);
41 XBT_PUBLIC(void) TRACE_create_category (const char *category, const char *type, const char *parent_category);
42 XBT_PUBLIC(void) TRACE_msg_set_task_category (m_task_t task, const char *category);
43 XBT_PUBLIC(void) TRACE_msg_set_process_category (m_process_t process, const char *category);
44 XBT_PUBLIC(void) TRACE_set_mask (int mask);
45 XBT_PUBLIC(void) __TRACE_host_variable (double time, const char *variable, double value, const char *what);
46 XBT_PUBLIC(void) __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what);
48 #define TRACE_start(filename) TRACE_start_with_mask(filename,TRACE_PLATFORM)
50 #define TRACE_host_variable_declare(var) \
51 __TRACE_host_variable(0,var,0,"declare");
53 #define TRACE_host_variable_set_with_time(time,var,value) \
54 __TRACE_host_variable(time,var,value,"set");
56 #define TRACE_host_variable_add_with_time(time,var,value) \
57 __TRACE_host_variable(time,var,value,"add");
59 #define TRACE_host_variable_sub_with_time(time,var,value) \
60 __TRACE_host_variable(time,var,value,"sub");
62 #define TRACE_host_variable_set(var,value) \
63 __TRACE_host_variable(MSG_get_clock(),var,value,"set");
65 #define TRACE_host_variable_add(var,value) \
66 __TRACE_host_variable(MSG_get_clock(),var,value,"add");
68 #define TRACE_host_variable_sub(var,value) \
69 __TRACE_host_variable(MSG_get_clock(),var,value,"sub");
71 #define TRACE_link_variable_declare(var) \
72 __TRACE_link_variable(0,NULL,NULL,var,0,"declare");
74 #define TRACE_link_variable_set_with_time(time,src,dst,var,value) \
75 __TRACE_link_variable(time,src,dst,var,value,"set");
77 #define TRACE_link_variable_add_with_time(time,src,dst,var,value) \
78 __TRACE_link_variable(time,src,dst,var,value,"add");
80 #define TRACE_link_variable_sub_with_time(time,src,dst,var,value) \
81 __TRACE_link_variable(time,src,dst,var,value,"sub");
83 #define TRACE_link_variable_set(src,dst,var,value) \
84 __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"set");
86 #define TRACE_link_variable_add(src,dst,var,value) \
87 __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"add");
89 #define TRACE_link_variable_sub(src,dst,var,value) \
90 __TRACE_link_variable(MSG_get_clock(),src,dst,var,value,"sub");
92 #else /* HAVE_TRACING */
94 #define TRACE_start(filename)
95 #define TRACE_start_with_mask(filename,mask)
97 #define TRACE_category(cat)
98 #define TRACE_define_type(cat,supercat,final)
99 #define TRACE_create_category(inst,cat)
100 #define TRACE_msg_set_task_category(task,cat)
101 #define TRACE_msg_set_process_category(proc,cat)
102 #define TRACE_set_mask(mask)
104 #define TRACE_host_variable_declare(var)
105 #define TRACE_host_variable_set_with_time(time,var,value)
106 #define TRACE_host_variable_add_with_time(time,var,value)
107 #define TRACE_host_variable_sub_with_time(time,var,value)
108 #define TRACE_host_variable_set(var,value)
109 #define TRACE_host_variable_add(var,value)
110 #define TRACE_host_variable_sub(var,value)
111 #define TRACE_link_variable_declare(var)
112 #define TRACE_link_variable_set_with_time(time,src,dst,var,value)
113 #define TRACE_link_variable_add_with_time(time,src,dst,var,value)
114 #define TRACE_link_variable_sub_with_time(time,src,dst,var,value)
115 #define TRACE_link_variable_set(src,dst,var,value)
116 #define TRACE_link_variable_add(src,dst,var,value)
117 #define TRACE_link_variable_sub(src,dst,var,value)
119 #endif /* HAVE_TRACING */
121 #endif /* INSTR_H_ */