Commit 03e86bd8 authored by Shane Snyder's avatar Shane Snyder

reorganize dxt & posix module interactions

parent 56a61bac
This diff is collapsed.
......@@ -157,22 +157,18 @@ static void posix_shutdown(
MPI_Comm mod_comm, darshan_record_id *shared_recs,
int shared_rec_count, void **posix_buf, int *posix_buf_sz);
/* DXT */
extern void dxt_posix_runtime_initialize();
extern void dxt_posix_track_new_file_record(
darshan_record_id rec_id, const char *path);
extern void dxt_posix_add_record_ref(
darshan_record_id rec_id, int fd);
extern void dxt_posix_write(int fd, int64_t offset, int64_t length,
double start_time, double end_time);
extern void dxt_posix_read(int fd, int64_t offset, int64_t length,
double start_time, double end_time);
/* extern DXT function defs */
extern void dxt_posix_write(darshan_record_id rec_id, int64_t offset,
int64_t length, double start_time, double end_time);
extern void dxt_posix_read(darshan_record_id rec_id, int64_t offset,
int64_t length, double start_time, double end_time);
static struct posix_runtime *posix_runtime = NULL;
static pthread_mutex_t posix_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static int instrumentation_disabled = 0;
static int my_rank = -1;
static int darshan_mem_alignment = 1;
static int enable_dxt_io_trace = 0;
#define POSIX_LOCK() pthread_mutex_lock(&posix_runtime_mutex)
#define POSIX_UNLOCK() pthread_mutex_unlock(&posix_runtime_mutex)
......@@ -182,10 +178,6 @@ static int darshan_mem_alignment = 1;
if(!instrumentation_disabled) { \
if(!posix_runtime) { \
posix_runtime_initialize(); \
/* DXT */ \
if (getenv("ENABLE_DXT_IO_TRACE")) { \
dxt_posix_runtime_initialize(); \
} \
} \
if(posix_runtime) break; \
} \
......@@ -210,13 +202,7 @@ static int darshan_mem_alignment = 1;
} \
rec_id = darshan_core_gen_record_id(newpath); \
rec_ref = darshan_lookup_record_ref(posix_runtime->rec_id_hash, &rec_id, sizeof(darshan_record_id)); \
if(!rec_ref) { \
rec_ref = posix_track_new_file_record(rec_id, newpath); \
/* DXT */ \
if (getenv("ENABLE_DXT_IO_TRACE")) { \
dxt_posix_track_new_file_record(rec_id, newpath); \
} \
} \
if(!rec_ref) rec_ref = posix_track_new_file_record(rec_id, newpath); \
if(!rec_ref) { \
if(newpath != __path) free(newpath); \
break; \
......@@ -236,10 +222,6 @@ static int darshan_mem_alignment = 1;
darshan_add_record_ref(&(posix_runtime->fd_hash), &__ret, sizeof(int), rec_ref); \
darshan_instrument_fs_data(rec_ref->fs_type, newpath, __ret); \
if(newpath != __path) free(newpath); \
/* DXT */ \
if (getenv("ENABLE_DXT_IO_TRACE")) { \
dxt_posix_add_record_ref(rec_id, __ret); \
} \
} while(0)
#define POSIX_RECORD_READ(__ret, __fd, __pread_flag, __pread_offset, __aligned, __tm1, __tm2) do { \
......@@ -256,8 +238,8 @@ static int darshan_mem_alignment = 1;
else \
this_offset = rec_ref->offset; \
/* DXT to record detailed read tracing information */ \
if (getenv("ENABLE_DXT_IO_TRACE")) { \
dxt_posix_read(__fd, this_offset, __ret, __tm1, __tm2); \
if(enable_dxt_io_trace) { \
dxt_posix_read(rec_ref->file_rec->base_rec.id, this_offset, __ret, __tm1, __tm2); \
} \
if(this_offset > rec_ref->last_byte_read) \
rec_ref->file_rec->counters[POSIX_SEQ_READS] += 1; \
......@@ -314,8 +296,8 @@ static int darshan_mem_alignment = 1;
else \
this_offset = rec_ref->offset; \
/* DXT to record detailed write tracing information */ \
if (getenv("ENABLE_DXT_IO_TRACE")) { \
dxt_posix_write(__fd, this_offset, __ret, __tm1, __tm2); \
if(enable_dxt_io_trace) { \
dxt_posix_write(rec_ref->file_rec->base_rec.id, this_offset, __ret, __tm1, __tm2); \
} \
if(this_offset > rec_ref->last_byte_written) \
rec_ref->file_rec->counters[POSIX_SEQ_WRITES] += 1; \
......@@ -1292,6 +1274,11 @@ static void posix_runtime_initialize()
}
memset(posix_runtime, 0, sizeof(*posix_runtime));
/* check if DXT (Darshan extended tracing) should be enabled */
if (getenv("ENABLE_DXT_IO_TRACE")) {
enable_dxt_io_trace = 1;
}
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment