X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/332285d51119f8f98270655bf88f485a9f914df1..917aef7fa18957ea33a3cd78ab61b5837b5e1663:/src/instr/instr_TI_trace.c diff --git a/src/instr/instr_TI_trace.c b/src/instr/instr_TI_trace.c index 036c7571ae..29754729df 100644 --- a/src/instr/instr_TI_trace.c +++ b/src/instr/instr_TI_trace.c @@ -1,8 +1,9 @@ -/* Copyright (c) 2010-2013. The SimGrid Team. +/* Copyright (c) 2010-2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ + #include "instr/instr_private.h" #include "xbt/virtu.h" /* sg_cmdline */ #include "xbt/xbt_os_time.h" @@ -71,8 +72,12 @@ void print_TICreateContainer(paje_event_t event) char *folder_name = bprintf("%s_files", TRACE_get_filename()); char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, ((createContainer_t) event->data)->container->name); +#ifdef WIN32 + mkdir(folder_name); +#else mkdir(folder_name, S_IRWXU | S_IRWXG | S_IRWXO); - temp = fopen(filename, "w"); /* FIXME: file is never closed */ +#endif + temp = fopen(filename, "w"); if (temp == NULL) xbt_die("Tracefile %s could not be opened for writing: %s", filename, strerror(errno)); @@ -89,6 +94,12 @@ void print_TICreateContainer(paje_event_t event) void print_TIDestroyContainer(paje_event_t event) { + if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file")|| + xbt_dict_length(tracing_files) == 1) { + FILE* f = xbt_dict_get_or_null(tracing_files, + ((destroyContainer_t) event->data)->container->name); + fclose(f); + } xbt_dict_remove(tracing_files, ((destroyContainer_t) event->data)->container->name); }