Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tracing option to trace uncategorized resource utilization
[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_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"
21
22 static int trace_configured = 0;
23
24 int TRACE_is_configured(void)
25 {
26   return trace_configured;
27 }
28
29 int TRACE_smpi_is_enabled(void)
30 {
31   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
32 }
33
34 int TRACE_smpi_is_grouped(void)
35 {
36   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI_GROUP);
37 }
38
39 int TRACE_platform_is_enabled(void)
40 {
41   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
42 }
43
44 int TRACE_uncategorized (void)
45 {
46   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_UNCATEGORIZED);
47 }
48
49 int TRACE_msg_task_is_enabled(void)
50 {
51   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
52 }
53
54 int TRACE_msg_process_is_enabled(void)
55 {
56   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
57 }
58
59 int TRACE_msg_volume_is_enabled(void)
60 {
61   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
62 }
63
64 char *TRACE_get_filename(void)
65 {
66   return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
67 }
68
69 char *TRACE_get_platform_method(void)
70 {
71   return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_PLATFORM_METHOD);
72 }
73
74 void TRACE_global_init(int *argc, char **argv)
75 {
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,
81                    NULL, NULL);
82
83   /* smpi */
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,
88                    NULL, NULL);
89
90   /* smpi grouped */
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,
95                    NULL, NULL);
96
97
98   /* platform */
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,
103                    NULL, NULL);
104
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,
110                    NULL, NULL);
111
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,
117                    1, NULL, NULL);
118
119   /* msg task */
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,
124                    NULL, NULL);
125
126   /* msg process */
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,
131                    NULL, NULL);
132
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,
138                    NULL, NULL);
139
140   /* instrumentation can be considered configured now */
141   trace_configured = 1;
142 }
143
144 #endif