Browse Source

prevent starpu_tasks_rec_complete from overwriting the FxT trace

Samuel Thibault 8 years ago
parent
commit
c6dd318e3f

+ 1 - 0
ChangeLog

@@ -39,6 +39,7 @@ New features:
   * Add starpu_fxt_trace_user_event_string.
   * Add starpu_tasks_rec_complete tool to add estimation times in tasks.rec
     files.
+  * Add STARPU_FXT_TRACE environment variable.
 
 StarPU 1.2.0 (svn revision 18521)
 ==============================================

+ 5 - 1
doc/doxygen/chapters/380_offline_performance_tools.doxy

@@ -92,7 +92,11 @@ the environment variable \ref STARPU_FXT_PREFIX.
 
 The additional configure option \ref enable-fxt-lock "--enable-fxt-lock" can
 be used to generate trace events which describes the locks behaviour during
-the execution.
+the execution. It is however very heavy and should not be used unless debugging
+StarPU's internal locking.
+
+The environment variable \ref STARPU_FXT_TRACE can be set to 0 to disable the
+generation of the <c>prof_file_XXX_YYY</c> file.
 
 \subsection CreatingAGanttDiagram Creating a Gantt Diagram
 

+ 7 - 0
doc/doxygen/chapters/501_environment_variables.doxy

@@ -637,6 +637,13 @@ This variable specifies in which file the debugging output should be saved to.
 This variable specifies in which directory to save the trace generated if FxT is enabled. It needs to have a trailing '/' character.
 </dd>
 
+<dt>STARPU_FXT_TRACE</dt>
+<dd>
+\anchor STARPU_FXT_TRACE
+\addindex __env__STARPU_FXT_TRACE
+This variable specifies whether to generate (1) or not (0) the FxT trace in /tmp/prof_file_XXX_YYY . The default is 1 (generate it)
+</dd>
+
 <dt>STARPU_LIMIT_CUDA_devid_MEM</dt>
 <dd>
 \anchor STARPU_LIMIT_CUDA_devid_MEM

+ 5 - 0
src/common/fxt.c

@@ -134,6 +134,9 @@ void _starpu_fxt_init_profiling(unsigned trace_buffer_size)
 {
 	unsigned threadid;
 
+	if (!starpu_get_env_number_default("STARPU_FXT_TRACE", 1))
+		return;
+
 	STARPU_PTHREAD_MUTEX_LOCK(&_starpu_fxt_started_mutex);
 	if (!_starpu_fxt_started)
 	{
@@ -189,6 +192,8 @@ static void _starpu_generate_paje_trace(char *input_fxt_filename, char *output_p
 
 void _starpu_stop_fxt_profiling(void)
 {
+	if (!_starpu_fxt_started)
+		return;
 	if (!_starpu_written)
 	{
 #ifdef STARPU_VERBOSE

+ 1 - 0
tools/starpu_tasks_rec_complete.c

@@ -62,6 +62,7 @@ int main(int argc, char *argv[]) {
 		}
 	}
 
+	setenv("STARPU_FXT_TRACE", "0", 1);
 	if (starpu_init(NULL) != 0)
 	{
 		fprintf(stderr, "StarPU initialization failure\n");