git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8111
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
#define OPT_TRACING_MSG_VOLUME "tracing/msg/volume"
#define OPT_TRACING_FILENAME "tracing/filename"
#define OPT_TRACING_MSG_VOLUME "tracing/msg/volume"
#define OPT_TRACING_FILENAME "tracing/filename"
+static int trace_configured = 0;
+
+int _TRACE_configured (void)
+{
+ return trace_configured;
+}
+
int _TRACE_smpi_enabled (void)
{
return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
int _TRACE_smpi_enabled (void)
{
return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_SMPI);
"Tracing of MSG communication volume (experimental).",
xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
NULL, NULL);
"Tracing of MSG communication volume (experimental).",
xbt_cfgelm_int, &default_tracing_msg_volume, 0, 1,
NULL, NULL);
+
+ /* instrumentation can be considered configured now */
+ trace_configured = 1;
+ if (!_TRACE_configured()){
+ THROW0 (tracing_error, TRACE_ERROR_START,
+ "TRACE_start should be called after SimGrid initialization functions.");
+ return 0;
+ }
+
if (IS_TRACING) { /* what? trace is already active... ignore.. */
if (IS_TRACING) { /* what? trace is already active... ignore.. */
- THROW0 (tracing_error, TRACE_ERROR_START,
- "TRACE_start called, but tracing is already active");
+ THROW0 (tracing_error, TRACE_ERROR_START,
+ "TRACE_start called, but tracing is already active.");
return 0;
}
char *filename = _TRACE_filename ();
return 0;
}
char *filename = _TRACE_filename ();
- file = fopen(filename, "w");
+ if (!filename){
+ THROW0 (tracing_error, TRACE_ERROR_START,
+ "Trace filename is not initialized.");
+ return 0;
+ }
+ FILE *file = fopen(filename, "w");
if (!file) {
THROW1 (tracing_error, TRACE_ERROR_START,
"Tracefile %s could not be opened for writing.", filename);
if (!file) {
THROW1 (tracing_error, TRACE_ERROR_START,
"Tracefile %s could not be opened for writing.", filename);
void TRACE_surf_gtnets_destroy (void *action);
/* from instr_config.c */
void TRACE_surf_gtnets_destroy (void *action);
/* from instr_config.c */
+int _TRACE_configured (void);
int _TRACE_smpi_enabled (void);
int _TRACE_platform_enabled (void);
int _TRACE_msg_task_enabled (void);
int _TRACE_smpi_enabled (void);
int _TRACE_platform_enabled (void);
int _TRACE_msg_task_enabled (void);