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. */
8 #include "instr/private.h"
12 #define OPT_TRACING "tracing"
13 #define OPT_TRACING_SMPI "tracing/smpi"
14 #define OPT_TRACING_SMPI_GROUP "tracing/smpi/group"
15 #define OPT_TRACING_PLATFORM "tracing/platform"
16 #define OPT_TRACING_UNCATEGORIZED "tracing/uncategorized"
17 #define OPT_TRACING_MSG_TASK "tracing/msg/task"
18 #define OPT_TRACING_MSG_PROCESS "tracing/msg/process"
19 #define OPT_TRACING_MSG_VOLUME "tracing/msg/volume"
20 #define OPT_TRACING_FILENAME "tracing/filename"
21 #define OPT_TRACING_PLATFORM_METHOD "tracing/platform/method"
23 static int trace_configured = 0;
25 int TRACE_is_enabled(void)
27 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING);
30 int TRACE_is_configured(void)
32 return trace_configured;
35 int TRACE_smpi_is_enabled(void)
37 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
40 int TRACE_smpi_is_grouped(void)
42 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI_GROUP);
45 int TRACE_platform_is_enabled(void)
47 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
50 int TRACE_uncategorized (void)
52 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_UNCATEGORIZED);
55 int TRACE_msg_task_is_enabled(void)
57 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
60 int TRACE_msg_process_is_enabled(void)
62 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
65 int TRACE_msg_volume_is_enabled(void)
67 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
70 char *TRACE_get_filename(void)
72 return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
75 char *TRACE_get_platform_method(void)
77 return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD);
80 void TRACE_global_init(int *argc, char **argv)
82 /* name of the tracefile */
83 char *default_tracing_filename = xbt_strdup("simgrid.trace");
84 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_FILENAME,
85 "Trace file created by the instrumented SimGrid.",
86 xbt_cfgelm_string, &default_tracing_filename, 1, 1,
90 int default_tracing = 0;
91 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING,
93 xbt_cfgelm_int, &default_tracing, 0, 1,
97 int default_tracing_smpi = 0;
98 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI,
99 "Tracing of the SMPI interface.",
100 xbt_cfgelm_int, &default_tracing_smpi, 0, 1,
104 int default_tracing_smpi_grouped = 0;
105 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI_GROUP,
106 "Group MPI processes by host.",
107 xbt_cfgelm_int, &default_tracing_smpi_grouped, 0, 1,
112 int default_tracing_platform = 0;
113 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM,
114 "Tracing of categorized platform (host and link) utilization.",
115 xbt_cfgelm_int, &default_tracing_platform, 0, 1,
118 /* tracing uncategorized resource utilization */
119 int default_tracing_uncategorized = 0;
120 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_UNCATEGORIZED,
121 "Tracing of uncategorized resource (host and link) utilization.",
122 xbt_cfgelm_int, &default_tracing_uncategorized, 0, 1,
125 /* platform method */
126 char *default_tracing_platform_method = xbt_strdup("b");
127 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD,
128 "Tracing method used to register categorized resource behavior.",
129 xbt_cfgelm_string, &default_tracing_platform_method, 1,
133 int default_tracing_msg_task = 0;
134 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_TASK,
135 "Tracing of MSG task behavior.",
136 xbt_cfgelm_int, &default_tracing_msg_task, 0, 1,
140 int default_tracing_msg_process = 0;
141 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_PROCESS,
142 "Tracing of MSG process behavior.",
143 xbt_cfgelm_int, &default_tracing_msg_process, 0, 1,
146 /* msg volume (experimental) */
147 int default_tracing_msg_volume = 0;
148 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_VOLUME,
149 "Tracing of MSG communication volume (experimental).",
150 xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
153 /* instrumentation can be considered configured now */
154 trace_configured = 1;