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_SMPI "tracing/smpi"
13 #define OPT_TRACING_SMPI_GROUP "tracing/smpi/group"
14 #define OPT_TRACING_PLATFORM "tracing/platform"
15 #define OPT_TRACING_UNCATEGORIZED "tracing/uncategorized"
16 #define OPT_TRACING_MSG_TASK "tracing/msg/task"
17 #define OPT_TRACING_MSG_PROCESS "tracing/msg/process"
18 #define OPT_TRACING_MSG_VOLUME "tracing/msg/volume"
19 #define OPT_TRACING_FILENAME "tracing/filename"
20 #define OPT_TRACING_PLATFORM_METHOD "tracing/platform/method"
22 static int trace_configured = 0;
24 int TRACE_is_configured(void)
26 return trace_configured;
29 int TRACE_smpi_is_enabled(void)
31 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
34 int TRACE_smpi_is_grouped(void)
36 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI_GROUP);
39 int TRACE_platform_is_enabled(void)
41 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
44 int TRACE_uncategorized (void)
46 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_UNCATEGORIZED);
49 int TRACE_msg_task_is_enabled(void)
51 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
54 int TRACE_msg_process_is_enabled(void)
56 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
59 int TRACE_msg_volume_is_enabled(void)
61 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
64 char *TRACE_get_filename(void)
66 return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
69 char *TRACE_get_platform_method(void)
71 return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD);
74 void TRACE_global_init(int *argc, char **argv)
76 /* name of the tracefile */
77 char *default_tracing_filename = xbt_strdup("simgrid.trace");
78 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_FILENAME,
79 "Trace file created by the instrumented SimGrid.",
80 xbt_cfgelm_string, &default_tracing_filename, 1, 1,
84 int default_tracing_smpi = 0;
85 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI,
86 "Tracing of the SMPI interface.",
87 xbt_cfgelm_int, &default_tracing_smpi, 0, 1,
91 int default_tracing_smpi_grouped = 0;
92 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI_GROUP,
93 "Group MPI processes by host.",
94 xbt_cfgelm_int, &default_tracing_smpi_grouped, 0, 1,
99 int default_tracing_platform = 0;
100 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM,
101 "Tracing of categorized platform (host and link) utilization.",
102 xbt_cfgelm_int, &default_tracing_platform, 0, 1,
105 /* tracing uncategorized resource utilization */
106 int default_tracing_uncategorized = 0;
107 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_UNCATEGORIZED,
108 "Tracing of uncategorized resource (host and link) utilization.",
109 xbt_cfgelm_int, &default_tracing_uncategorized, 0, 1,
112 /* platform method */
113 char *default_tracing_platform_method = xbt_strdup("b");
114 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD,
115 "Tracing method used to register categorized resource behavior.",
116 xbt_cfgelm_string, &default_tracing_platform_method, 1,
120 int default_tracing_msg_task = 0;
121 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_TASK,
122 "Tracing of MSG task behavior.",
123 xbt_cfgelm_int, &default_tracing_msg_task, 0, 1,
127 int default_tracing_msg_process = 0;
128 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_PROCESS,
129 "Tracing of MSG process behavior.",
130 xbt_cfgelm_int, &default_tracing_msg_process, 0, 1,
133 /* msg volume (experimental) */
134 int default_tracing_msg_volume = 0;
135 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_VOLUME,
136 "Tracing of MSG communication volume (experimental).",
137 xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
140 /* instrumentation can be considered configured now */
141 trace_configured = 1;