Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a7101621edb3b23ba7f88347bff76486cf7f2e11
[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
19 static int trace_configured = 0;
20
21 int _TRACE_configured (void)
22 {
23   return trace_configured;
24 }
25
26 int _TRACE_smpi_enabled (void)
27 {
28   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
29 }
30
31 int _TRACE_platform_enabled (void)
32 {
33   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_PLATFORM);
34 }
35
36 int _TRACE_msg_task_enabled (void)
37 {
38   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_TASK);
39 }
40
41 int _TRACE_msg_process_enabled (void)
42 {
43   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_PROCESS);
44 }
45
46 int _TRACE_msg_volume_enabled (void)
47 {
48   return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_MSG_VOLUME);
49 }
50
51 char *_TRACE_filename (void)
52 {
53   return xbt_cfg_get_string (_surf_cfg_set, OPT_TRACING_FILENAME);
54 }
55
56 void TRACE_global_init(int *argc, char **argv)
57 {
58   /* name of the tracefile */
59   char *default_tracing_filename = xbt_strdup("simgrid.trace");
60   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_FILENAME,
61                     "Trace file created by the instrumented SimGrid.",
62                     xbt_cfgelm_string, &default_tracing_filename, 1, 1,
63                     NULL, NULL);
64
65   /* smpi */
66   int default_tracing_smpi = 0;
67   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI,
68                    "Tracing of the SMPI interface.",
69                    xbt_cfgelm_int, &default_tracing_smpi, 0, 1,
70                    NULL, NULL);
71
72   /* platform */
73   int default_tracing_platform = 0;
74   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_PLATFORM,
75                    "Tracing of categorized platform (host and link) utilization.",
76                    xbt_cfgelm_int, &default_tracing_platform, 0, 1,
77                    NULL, NULL);
78
79   /* msg task */
80   int default_tracing_msg_task = 0;
81   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_TASK,
82                    "Tracing of MSG task behavior.",
83                    xbt_cfgelm_int, &default_tracing_msg_task, 0, 1,
84                    NULL, NULL);
85
86   /* msg process */
87   int default_tracing_msg_process = 0;
88   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_PROCESS,
89                    "Tracing of MSG process behavior.",
90                    xbt_cfgelm_int, &default_tracing_msg_process, 0, 1,
91                    NULL, NULL);
92
93   /* msg volume (experimental) */
94   int default_tracing_msg_volume = 0;
95   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_MSG_VOLUME,
96                    "Tracing of MSG communication volume (experimental).",
97                    xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
98                    NULL, NULL);
99
100   /* instrumentation can be considered configured now */
101   trace_configured = 1;
102 }
103
104 #endif