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_MSG_TASK "tracing/msg/task"
16 #define OPT_TRACING_MSG_PROCESS "tracing/msg/process"
17 #define OPT_TRACING_MSG_VOLUME "tracing/msg/volume"
18 #define OPT_TRACING_FILENAME "tracing/filename"
19 #define OPT_TRACING_PLATFORM_METHOD "tracing/platform/method"
21 static int trace_configured = 0;
23 int TRACE_is_configured(void)
25 return trace_configured;
28 int TRACE_smpi_is_enabled(void)
30 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
33 int TRACE_smpi_is_grouped(void)
35 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI_GROUP);
38 int TRACE_platform_is_enabled(void)
40 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
43 int TRACE_msg_task_is_enabled(void)
45 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
48 int TRACE_msg_process_is_enabled(void)
50 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
53 int TRACE_msg_volume_is_enabled(void)
55 return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
58 char *TRACE_get_filename(void)
60 return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
63 char *TRACE_get_platform_method(void)
65 return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD);
68 void TRACE_global_init(int *argc, char **argv)
70 /* name of the tracefile */
71 char *default_tracing_filename = xbt_strdup("simgrid.trace");
72 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_FILENAME,
73 "Trace file created by the instrumented SimGrid.",
74 xbt_cfgelm_string, &default_tracing_filename, 1, 1,
78 int default_tracing_smpi = 0;
79 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI,
80 "Tracing of the SMPI interface.",
81 xbt_cfgelm_int, &default_tracing_smpi, 0, 1,
85 int default_tracing_smpi_grouped = 0;
86 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI_GROUP,
87 "Group MPI processes by host.",
88 xbt_cfgelm_int, &default_tracing_smpi_grouped, 0, 1,
93 int default_tracing_platform = 0;
94 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM,
95 "Tracing of categorized platform (host and link) utilization.",
96 xbt_cfgelm_int, &default_tracing_platform, 0, 1,
100 char *default_tracing_platform_method = xbt_strdup("b");
101 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD,
102 "Tracing method used to register categorized resource behavior.",
103 xbt_cfgelm_string, &default_tracing_platform_method, 1,
107 int default_tracing_msg_task = 0;
108 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_TASK,
109 "Tracing of MSG task behavior.",
110 xbt_cfgelm_int, &default_tracing_msg_task, 0, 1,
114 int default_tracing_msg_process = 0;
115 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_PROCESS,
116 "Tracing of MSG process behavior.",
117 xbt_cfgelm_int, &default_tracing_msg_process, 0, 1,
120 /* msg volume (experimental) */
121 int default_tracing_msg_volume = 0;
122 xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_VOLUME,
123 "Tracing of MSG communication volume (experimental).",
124 xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
127 /* instrumentation can be considered configured now */
128 trace_configured = 1;