Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
made some changes to allow more than one DO_ONCE block. also fixed bug in
[simgrid.git] / src / smpi / private.h
index 3a5c8fa..285c547 100644 (file)
@@ -11,9 +11,6 @@
 #define SMPI_DEFAULT_SPEED 100
 #define SMPI_REQUEST_MALLOCATOR_SIZE 100
 #define SMPI_MESSAGE_MALLOCATOR_SIZE 100
-// FIXME: should probably be dynamic datatype...
-// or could include code to dynamically expand when full
-#define SMPI_MAX_TIMES 10
 
 // smpi mpi communicator
 typedef struct smpi_mpi_communicator_t {
@@ -72,6 +69,14 @@ typedef struct smpi_received_message_t {
 } s_smpi_received_message_t;
 typedef struct smpi_received_message_t *smpi_received_message_t;
 
+typedef struct smpi_do_once_duration_node_t {
+       char *file;
+       int line;
+       double duration;
+       struct smpi_do_once_duration_node_t *next;
+} s_smpi_do_once_duration_node_t;
+typedef struct smpi_do_once_duration_node_t *smpi_do_once_duration_node_t;
+
 typedef struct smpi_global_t {
 
        // config vars
@@ -108,13 +113,14 @@ typedef struct smpi_global_t {
        smx_mutex_t       timer_mutex;
        smx_cond_t        timer_cond;
 
-       // keeps track of previous times
-       double            times[SMPI_MAX_TIMES];
-       int               times_max;
-       smx_mutex_t       times_mutex;
-
        smx_mutex_t       execute_mutex;
        smx_cond_t        execute_cond;
+       int               execute_count;
+
+       // keeps track of previous times
+       smpi_do_once_duration_node_t do_once_duration_nodes;
+       smx_mutex_t do_once_mutex;
+       double *do_once_duration;
 
 } s_smpi_global_t;
 typedef struct smpi_global_t *smpi_global_t;
@@ -136,8 +142,10 @@ int smpi_mpi_irecv(smpi_mpi_request_t request);
 int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t *status);
 
 void smpi_execute(double duration);
+void smpi_start_timer(void);
+double smpi_stop_timer(void);
 void smpi_bench_begin(void);
-double smpi_bench_end(void);
+void smpi_bench_end(void);
 void smpi_bench_skip(void);
 
 void smpi_global_init(void);