Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Changed optimizing metric to log error
[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_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"
20
21 static int trace_configured = 0;
22
23 int TRACE_is_configured(void)
24 {
25   return trace_configured;
26 }
27
28 int TRACE_smpi_is_enabled(void)
29 {
30   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
31 }
32
33 int TRACE_smpi_is_grouped(void)
34 {
35   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI_GROUP);
36 }
37
38 int TRACE_platform_is_enabled(void)
39 {
40   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
41 }
42
43 int TRACE_msg_task_is_enabled(void)
44 {
45   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
46 }
47
48 int TRACE_msg_process_is_enabled(void)
49 {
50   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
51 }
52
53 int TRACE_msg_volume_is_enabled(void)
54 {
55   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
56 }
57
58 char *TRACE_get_filename(void)
59 {
60   return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
61 }
62
63 char *TRACE_get_platform_method(void)
64 {
65   return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD);
66 }
67
68 void TRACE_global_init(int *argc, char **argv)
69 {
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,
75                    NULL, NULL);
76
77   /* smpi */
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,
82                    NULL, NULL);
83
84   /* smpi grouped */
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,
89                    NULL, NULL);
90
91
92   /* platform */
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,
97                    NULL, NULL);
98
99   /* platform method */
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,
104                    1, NULL, NULL);
105
106   /* msg task */
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,
111                    NULL, NULL);
112
113   /* msg process */
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,
118                    NULL, NULL);
119
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,
125                    NULL, NULL);
126
127   /* instrumentation can be considered configured now */
128   trace_configured = 1;
129 }
130
131 #endif