Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
684b36c5a566b5534f2e69c0c787425621c93ed9
[simgrid.git] / src / instr / instr_config.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7
8 #include "instr/private.h"
9
10 #ifdef HAVE_TRACING
11
12 #define OPT_TRACING_SMPI          "tracing/smpi"
13 #define OPT_TRACING_PLATFORM      "tracing/platform"
14 #define OPT_TRACING_MSG_TASK      "tracing/msg/task"
15 #define OPT_TRACING_MSG_PROCESS   "tracing/msg/process"
16 #define OPT_TRACING_MSG_VOLUME    "tracing/msg/volume"
17 #define OPT_TRACING_FILENAME      "tracing/filename"
18 #define OPT_TRACING_PLATFORM_METHOD "tracing/platform/method"
19
20 static int trace_configured = 0;
21
22 int TRACE_is_configured(void)
23 {
24   return trace_configured;
25 }
26
27 int TRACE_smpi_is_enabled(void)
28 {
29   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
30 }
31
32 int TRACE_platform_is_enabled(void)
33 {
34   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
35 }
36
37 int TRACE_msg_task_is_enabled(void)
38 {
39   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
40 }
41
42 int TRACE_msg_process_is_enabled(void)
43 {
44   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
45 }
46
47 int TRACE_msg_volume_is_enabled(void)
48 {
49   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
50 }
51
52 char *TRACE_get_filename(void)
53 {
54   return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
55 }
56
57 char *TRACE_get_platform_method(void)
58 {
59   return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD);
60 }
61
62 void TRACE_global_init(int *argc, char **argv)
63 {
64   /* name of the tracefile */
65   char *default_tracing_filename = xbt_strdup("simgrid.trace");
66   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_FILENAME,
67                    "Trace file created by the instrumented SimGrid.",
68                    xbt_cfgelm_string, &default_tracing_filename, 1, 1,
69                    NULL, NULL);
70
71   /* smpi */
72   int default_tracing_smpi = 0;
73   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI,
74                    "Tracing of the SMPI interface.",
75                    xbt_cfgelm_int, &default_tracing_smpi, 0, 1,
76                    NULL, NULL);
77
78   /* platform */
79   int default_tracing_platform = 0;
80   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM,
81                    "Tracing of categorized platform (host and link) utilization.",
82                    xbt_cfgelm_int, &default_tracing_platform, 0, 1,
83                    NULL, NULL);
84
85   /* platform method */
86   char *default_tracing_platform_method = xbt_strdup("b");
87   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD,
88                    "Tracing method used to register categorized resource behavior.",
89                    xbt_cfgelm_string, &default_tracing_platform_method, 1,
90                    1, NULL, NULL);
91
92   /* msg task */
93   int default_tracing_msg_task = 0;
94   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_TASK,
95                    "Tracing of MSG task behavior.",
96                    xbt_cfgelm_int, &default_tracing_msg_task, 0, 1,
97                    NULL, NULL);
98
99   /* msg process */
100   int default_tracing_msg_process = 0;
101   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_PROCESS,
102                    "Tracing of MSG process behavior.",
103                    xbt_cfgelm_int, &default_tracing_msg_process, 0, 1,
104                    NULL, NULL);
105
106   /* msg volume (experimental) */
107   int default_tracing_msg_volume = 0;
108   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_VOLUME,
109                    "Tracing of MSG communication volume (experimental).",
110                    xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
111                    NULL, NULL);
112
113   /* instrumentation can be considered configured now */
114   trace_configured = 1;
115 }
116
117 #endif