Browse Source

permit to change the trace buffer size

Samuel Thibault 12 years ago
parent
commit
3c1aa1bd4b
6 changed files with 19 additions and 6 deletions
  1. 4 0
      ChangeLog
  2. 6 0
      doc/chapters/basic-api.texi
  3. 3 0
      include/starpu.h
  4. 2 4
      src/common/fxt.c
  5. 1 1
      src/common/fxt.h
  6. 3 1
      src/core/workers.c

+ 4 - 0
ChangeLog

@@ -116,6 +116,10 @@ Changes:
 
 Small features:
   * Add starpu_worker_get_by_type and starpu_worker_get_by_devid
+  * Add no_auto_start_trace configuration field to permit avoiding starting FxT
+  traces from starpu_init.
+  * Add trace_buffer_size configuration field to permit to specify the tracing
+  buffer size.
 
 Small changes:
   * STARPU_NCPU should now be used instead of STARPU_NCPUS. STARPU_NCPUS is

+ 6 - 0
doc/chapters/basic-api.texi

@@ -198,6 +198,12 @@ The default (0) means that the FxT tracing will start as soon as
 @code{starpu_init} is called.
 Setting it to 1 permits to avoid tracing start so early, and instead start when the application calls @code{starpu_start_fxt_profiling}.
 
+@item @code{trace_buffer_size}
+Specifies the buffer size used for FxT tracing. Starting from FxT version
+0.2.12, the buffer will automatically be flushed when it fills in, but it may
+still be interesting to specify a bigger value to avoid any flushing (which
+would disturb the trace).
+
 @end table
 @end deftp
 

+ 3 - 0
include/starpu.h

@@ -151,6 +151,9 @@ struct starpu_conf
 	/* Indicates whether we start the tracing automatically
 	   or we leave the appl start it when it wants to */
 	unsigned no_auto_start_trace;
+
+	/* Specifies the buffer size for tracing */
+	unsigned trace_buffer_size;
 };
 
 /* Initialize a starpu_conf structure with default values. */

+ 2 - 4
src/common/fxt.c

@@ -35,8 +35,6 @@
 #include <sys/thr.h>       /* for thr_self() */
 #endif
 
-#define _STARPU_PROF_BUFFER_SIZE  (8*1024*1024)
-
 static char _STARPU_PROF_FILE_USER[128];
 static int _starpu_fxt_started = 0;
 
@@ -107,7 +105,7 @@ void starpu_start_fxt_profiling()
 	fut_keychange(FUT_ENABLE, FUT_KEYMASKALL, threadid);
 }
 
-void _starpu_init_fxt_profiling(unsigned no_auto_start_trace)
+void _starpu_init_fxt_profiling(unsigned no_auto_start_trace, unsigned trace_buffer_size)
 {
 	unsigned threadid;
 
@@ -136,7 +134,7 @@ void _starpu_init_fxt_profiling(unsigned no_auto_start_trace)
 
 	unsigned int key_mask = no_auto_start_trace ? 0 : FUT_KEYMASKALL;
 
-	if (fut_setup(_STARPU_PROF_BUFFER_SIZE, key_mask, threadid) < 0)
+	if (fut_setup(trace_buffer_size / sizeof(unsigned long), key_mask, threadid) < 0)
 	{
 		perror("fut_setup");
 		STARPU_ABORT();

+ 1 - 1
src/common/fxt.h

@@ -122,7 +122,7 @@ void fut_set_filename(char *filename);
 long _starpu_gettid(void);
 
 /* Initialize the FxT library. */
-void _starpu_init_fxt_profiling(unsigned no_auto_start_trace);
+void _starpu_init_fxt_profiling(unsigned no_auto_start_trace, unsigned trace_buffer_size);
 
 /* Stop the FxT library, and generate the trace file. */
 void _starpu_stop_fxt_profiling(void);

+ 3 - 1
src/core/workers.c

@@ -678,6 +678,8 @@ int starpu_conf_init(struct starpu_conf *conf)
 #endif
 
 	conf->no_auto_start_trace = 0;
+	/* 64MiB by default */
+	conf->trace_buffer_size = 64<<20;
 	return 0;
 }
 
@@ -804,7 +806,7 @@ int starpu_init(struct starpu_conf *user_conf)
 	_starpu_init_tags();
 
 #ifdef STARPU_USE_FXT
-	_starpu_init_fxt_profiling(config.conf->no_auto_start_trace);
+	_starpu_init_fxt_profiling(config.conf->no_auto_start_trace, config.conf->trace_buffer_size);
 #endif
 
 	_starpu_open_debug_logfile();